I am using the following configuration for my database connection pool. Using HikariCP 1.4.0, jdk1.6.0_45 and Oracle Express 11g, running on Windows 7.
HikariConfig config = new HikariConfig();
config.setDataSourceClassName("oracle.jdbc.pool.OracleDataSource");
config.addDataSourceProperty("serverName", "localhost");
config.addDataSourceProperty("url", "jdbc:oracle:thin:@localhost:1521:XE");
config.addDataSourceProperty("user", "bob");
config.addDataSourceProperty("password", "bob1");
config.setPoolName("steve");
HikariDataSource ds = new HikariDataSource(config);
// do some inserts and reads here ... works great
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName poolName = new ObjectName("com.zaxxer.hikari:type=Pool (steve)");
Integer idleConnections = (Integer) mBeanServer.getAttribute(poolName, "IdleConnections");
System.out.println("Number of Idle Connections : " + idleConnections);
I get this stack trace:
javax.management.InstanceNotFoundException: com.zaxxer.hikari:type=Pool (steve)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:662)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:639)
Using JConsole and attaching to the running process. I see the following MBeans: JMImplemtation, com.oracle.jdbc, com.sun.management, java.lang, java.nio, java.util.logging.
I am not seeing anything related to a Hikari connection pool.
Any suggestions what I can try next?