How to view active database connections in Tomcat

  1. Configure remote JMX Connectivity for Tomcat by adding these JAVA OPTIONS
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

2.  Start jmxconsole and connect to the remote tomcat process.

jconsole connection

3. Go to MBeans -> Datasource -> Application Name -> Your Datasource -> numActive

active database connection