1

I am searching for some way to monitor and gather info about existing connections to database in connection pool. For example some info about number of existing connections and another usable info about this.

Any suggestions how to do it ?

My technology stack is mybatis and spring-boot deployed on tomcat.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Spring fancy
  • 303
  • 1
  • 3
  • 9

1 Answers1

0

Read the documentation for the connection pool you're using. Most of them have some sort of logging functionality that can display stats from the pool when logging is enabled.

HikariCP for example seems to support Dropwizard Metrics for pool status. Other pools may have other functionality.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
  • Thanks. My JDBC driver is MSSQL. Could you give me some link to proper place in reference ? – Spring fancy Dec 20 '17 at 19:30
  • Driver logging is distinct from connection pool logging. Are you using [jTDS or Microsoft's](https://stackoverflow.com/questions/4393766/differences-between-ms-sql-microsofts-jdbc-drivers-and-jtdss-driver) driver? Either way, check the documentation for your specific driver, then find out which connection pool you're using and read the documentation for that. – Kayaman Dec 20 '17 at 19:34
  • No, this one: https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc/6.1.0.jre8 – Spring fancy Dec 20 '17 at 19:35
  • That **is** the Microsoft driver. You might want to switch to jTDS. I bet it has better support for things. Better documentation too probably. Anyway, find out what connection pool you're using. – Kayaman Dec 20 '17 at 19:37
  • How to find out it ? – Spring fancy Dec 20 '17 at 19:53
  • Looks like Spring boot uses Tomcat pooling by default. Here's some documentation: https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html – Kayaman Dec 20 '17 at 19:59