title: Tomcat JDBC Pool Metrics
body: <p>I am running Tomcat 8.0.29 and I'm using the Tomcat provided JDBC Pool initialized using JNDI resource.  I am connecting to a Postgres database and am using the JDBC driver released with 9.4. Everything works fine and I am able to connect and execute queries. </p>
  
  <p>I would like to gather metrics about the connection pool from within my java program.  For example, I would like to know how many idle connections I currently have and/or how many connections from the pool are in use. I have tried increasing the logging level and that did not give me any of these pool metrics.  I have tried looking at JMX and I do not see any MBeans that have this information.  I did see some other posts claiming that I could use MBeans, but the version that I am running doesn't have those MBeans.</p>
  
  <p>I have searched quite a bit and cannot find an answer to this simple question.  I basically just want to log or be able to query metrics related to the JDBC pool within Tomcat.</p>