commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [DBCP] pool monitor/info/status API?
Date Wed, 16 Jun 2004 19:51:12 GMT
Hibernate has a DBCPConnectionProvider, unfortunally it doesn't export 
the properties you need.
You could use the DatasourceConnectionProvider, then you can lookup 
the datasource outside Hibernate using JNDI.
But maybe it is simple to implement your own custom 
DBCPConnectionProvider exporting the API you need.

-- Dirk

ogjunk-commons@yahoo.com wrote:

> Hello,
> 
> --- Dirk Verbeeck <dirk.verbeeck@pandora.be> wrote:
> 
>>I assume you are using BasicDataSource on Tomcat.
> 
> 
> Actually, I am using DBCP through Hibernate and inside of Jetty.  I am
> not using it as a DataSource, but rather by loading a driver class,
> etc., or at least I think that is what Hibernate is doing.
> 
> 
>>You can simply lookup the datasource using JNDI like you alway do.
>>Cast it to BasicDataSource and then use the available getters:
>>ds.getNumActive(), ds.getNumIdle(), ds.getMaxActive(), ...
> 
> 
> I think my environment (Hibernate) does not expose DBCP through its
> API, so I don't think I can ask it to give me a reference to the
> underlying DataSource or anything such.
> So I am wondering whether DBCP offers some static hooks (i.e. methods)
> that would allow me to look up my connection pool and then do something
> like what you suggested above, in order to get the information about
> the pool state?
> 
> In other words, is there any class/method that allows me to do this:
> SomePoolClass pool = SomeDBCPClass.getPool();
> pool.getNumActive();
> pool.getNumIdle();
> ...
> 
> Or something like that...
> 
> 
>>Here is a page I use to debug JNDI configurations:
>>http://cvs.apache.org/~dirkv/builds/showJNDI.jsp
>>
>>This should get you started, feel free to update the Wiki if you find
>>this usefull.
> 
> 
> Thanks Dirk.
> 
> Otis
> 
> 
>>ogjunk-commons@yahoo.com wrote:
>>
>>>Hello,
>>>
>>>I looked at the site and Javadocs and Wiki and glanced at the
>>
>>mailing
>>
>>>list archives, but did not see what I was looking for, which is:
>>>
>>>Is there a way to peek into a DBCP-managed connection pool in order
>>
>>to
>>
>>>get some information about the status of the pool?
>>>(e.g. current pool size, max pool size, etc.)
>>>
>>>Is this the DBCP entry point that I am looking for:
>>>
>>
> http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/PoolableConnectionFactory.html#getPool()
> 
>>>Thank you,
>>>Otis
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message