Search code examples
oracle-databasehibernateoracle-sqldeveloperc3p0

How can I check active connection in Oracle?


We have used connection pooling using hibernate, we want to track active connections in the pool. Is it possible to find out using query OR any DB tool?


Solution

  • You can monitor c3p0 by JMX, or write your own code to do so via the PooledDataSource interface.

    The property you want to observe is numBusyConnectionsAllUsers or numBusyConnectionsDefaultUser (whether via JMX or direct access to PooledDataSource. These two values will be the same in the most usual case where you only access Connections via the authetication information configured in your DataSource. If you do use multiple authentications, then the two values will be different (and you might be interested in the method getNumBusyConnections(username, password).

    JMX monitoring is fun and easy!