Universal Connection Pool (UCP) provides a set of run-time statistics for the connection pool. These statistics can be divided into the following two categories:
These statistics apply only to the current running connection pool instance.
These statistics are collected across multiple pool start/stop cycles.
oracle.ucp.UniversalConnectionPoolStatistics interface provides methods that are used to query the connection pool statistics. The methods of this interface can be called from a pool-enabled data source and pool-enabled XA data source, using the
oracle.ucp.jdbc.PoolDataSource.getStatistics method. For example:
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource(); ... ... int totalConnsCount = pds.getStatistics().getTotalConnectionsCount(); System.out.println("The total connetion count in the pool is "+ totalConnsCount +".");
oracle.ucp.jdbc.PoolDataSource.getStatistics method can also be called by itself to return all connection pool statistics as a