I am using Hibernate in my JBoss war, using c3p0 for connection pooling, both configured within a hibernate.cfg.xml config file in my classpath
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
I've seen server.log generates lines with interesting information about the connection pool:
DEBUG [com.mchange.v2.resourcepool.BasicResourcePool] trace com.mchange.v2.resourcepool.BasicResourcePool@63f5e4b6 [managed: 10, unused: 9, excluded: 0]
For my monitoring pool (I am using nagios) I'd like to provide a JSP telling how many connections are being used and how many are free, as the log file says.
How can I ask c3p0 how many managed and unused connections are there?