From commons-user-return-8023-apmail-jakarta-commons-user-archive=jakarta.apache.org@jakarta.apache.org Wed Jun 16 19:53:36 2004 Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 56097 invoked from network); 16 Jun 2004 19:53:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Jun 2004 19:53:36 -0000 Received: (qmail 2672 invoked by uid 500); 16 Jun 2004 19:51:53 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 2530 invoked by uid 500); 16 Jun 2004 19:51:52 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 2280 invoked by uid 99); 16 Jun 2004 19:51:50 -0000 Received: from [195.130.132.56] (HELO adicia.telenet-ops.be) (195.130.132.56) by apache.org (qpsmtpd/0.27.1) with ESMTP; Wed, 16 Jun 2004 12:51:49 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id D3BAC4413A for ; Wed, 16 Jun 2004 21:51:15 +0200 (MEST) Received: from pandora.be (D5E05E70.kabel.telenet.be [213.224.94.112]) by adicia.telenet-ops.be (Postfix) with ESMTP id ACF8D4417E for ; Wed, 16 Jun 2004 21:51:15 +0200 (MEST) Message-ID: <40D0A4B0.5010201@pandora.be> Date: Wed, 16 Jun 2004 21:51:12 +0200 From: Dirk Verbeeck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [DBCP] pool monitor/info/status API? References: <20040616070235.4039.qmail@web12701.mail.yahoo.com> In-Reply-To: <20040616070235.4039.qmail@web12701.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 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