Hi,
I'm interested in using C3PO, or DBCP with HIbernate. I find JNDI to be more trouble that it is worth when trying to run unit tests. At this point, most of the projects I work on are routing all access to db connections through hibernate, providing an easy way to change our configuration from unit testing with local jdbc connections, to JNDI, or other source at runtime. Okay, so here's what I'm wondering.
If I allow Hibernate to set-up the connection pool using c3po, or dbcp, is there some way i can get access to a handle to the connection pool. I would like an admin page where I can display #of available connections, in use, etc.
In other words, from the dbcp sample code, i'd like to be able to issue statements like these
System.out.println("NumActive: " + connectionPool.getNumActive());
System.out.println("NumIdle: " + connectionPool.getNumIdle());
One solution I see, is potentially adding methods to connection provider that allow access to the underlying pool after a cast...
Of course, I could pass Hib the conenction whenever I open a session, and create the pool on my own, but that seems like a bunch of work.
Thanks!
James
|