I need to get the stats of my tomcat server's connection pool
from the deployed webapp.
like., active connection count, idle connection count, pool size, last wait time etc.,
I was to able to get some stats from org.apache.tomcat.dbcp.dbcp.BasicDataSource (narrowed from java.sql.DataSource through JNDI)
. But its not providing the stats like last connection wait time etc.,
Is there any other (better) way to retrieve these stats ?
Thanks in advance.
We create a singleton instance (per app) of org.apache.tomcat.jdbc.pool.ConnectionPool instead of allowing Tomcat to create it. We use a servlet to display a web page with pool statistics by accessing the pool getters like getSize(), getIdle(), etc. This is useful for debugging connection problems.
The downside with this approach is that you can't use JNDI to get a connection.
I always thought there should be a standard way to get common connection pool stats.