0

The context:

I have a Java application that's using HikariCP for its connection pooling solution. While lightning-fast, HikariCP doesn't have a lot of configuration options, by design, and that's all fine and dandy except I need to set a connection property, and while a DataSource like Tomcat's gives me the ability to do something like:

tomcatDataSource.setConnectionProperties("someProperty=true");

Hikari's DataSource object doesn't have such a method.

My options, as far as I've been able to tell are to either create a DataSource object manually and pass it to Hikari to wrap it in it's own class, or to include the connection property as part of the connection URL.

(Just to make sure we're on the same page, I'm talking about the "sendStringParametersAsUnicode" flag as described in this document: Setting the connection properties - SQL Server)

The question (also known as "so far this question seems to belong in StackOverflow but hopefully you kept reading"):

Is there a way, on the database side, to see the connection properties of an active connection? In SSMS or some other tool? I tried SSMS's activity monitor on the target database, and right clicking on anything that seemed right-clickable, but nothing mentioned the properties of the open connections. Is this even possible?

I'd like to see the properties so I can double-check if my two options described above for setting this flag actually work.

3

That property is a setting for the client-side of the connection. Not the server-side, so you won't be able to directly observe this setting from SQL Server.

You can observe the effect of that setting using SQL Server Profiler or Extended Events, looking for the Batch and RPC events. They will show you the parameter data types sent by the client.

0

Figure out the session ID of the client using:

EXEC sp_who2

Then you can find some connection properties in these dynamic management views:

SELECT * FROM sys.dm_exec_connections
SELECT * FROM sys.dm_exec_sessions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.