Replies: 4 comments 3 replies
-
The mssql-jdbc library doesn't implement pooling itself. The SQLServerPooledConnection class is leveraged by 3rd party pooling libraries and won't have statistics about their pool sizes/use other than that the pool has requested a new connection (or reused a connection) from the driver, which you are seeing in the logs. You'll need to see what logging needs to be enabled in your pooling library to gather more info about the pool state. |
Beta Was this translation helpful? Give feedback.
-
you’re not missing a logging flag the Microsoft JDBC driver just doesn’t log pool state. The numbers you see (SQLServerPooledConnection:X) are just internal IDs for physical connections. If you need pool statistics, you’ll have to rely on your pooling library (e.g., HikariCP) instead of the driver itself. |
Beta Was this translation helpful? Give feedback.
-
ok bro, so those IDs are not from SQL Server they’re just made by the JDBC driver every new connection gets the next number the counter won’t reset till you restart JVM. |
Beta Was this translation helpful? Give feedback.
-
Sometimes they starts from 7 or 20 because earlier you got some misbehaved connections or existing ones , as they will only go to zero when you will restart your JVM as told you |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to debug an issue with our Java application that sometimes, for some not so apparent reason, the application cannot connect to SQL Server. I suspect that this issue has something to do with the connection pool size. I'm trying to setup SQL logging as described in https://learn.microsoft.com/en-us/sql/connect/jdbc/tracing-driver-operation?view=sql-server-ver16 so that I could clearly see how many connections are used and how many pool connection are still free/idle. I have configured it the following way:
This produces the output like this:
I'm still puzzled though by this output as it doesn't tell me anything about the state of the pool itself. Numbers in
SQLServerPooledConnection:**11**
irSQLServerPooledConnection:**10**
sometimes increases, sometimes decreases, but it is unclear if these IDs actually mean that I have used up all 10 or 11 pooled connections in total or if it just internal ID which could be any number?I tried various other combinations of internal and public classes with FINER and FINE logging levels, but cannot get anything concrete in the logs.
Am I missing something or logging pool's state is currently not implemented? Also, how to interpret those
SQLServerPooledConnection:**X**
numbers?Any pointers would be much appreciated.
P.S. I cannot debug this issue on the server side because the issue happens to only to one client and only at times. I don't have direct access to the SQL server.
Beta Was this translation helpful? Give feedback.
All reactions