You can cast your datasource object to be a BasicDataSource
then the javadoc gives you all kinds of things you can get.
like getNumActive(), getNumIdle() etc
(for dbcp 1.3)
http://commons.apache.org/dbcp/api-1.3/index.html



Dhiren Bhatia wrote:
> I've configured my DB connection pool as follows:
> 
> context.xml
> 
> <Resource name="jdbc/myserver" auth="Container" type="javax.sql.DataSource"
> 
> maxActive="100" maxIdle="30" maxWait="10000" username="xxx"
> 
> password="xxx" driverClassName="com.mysql.jdbc.Driver"
> 
> url="jdbc:mysql://a.b.c:3306/Test" removeAbandoned="true"
> 
> removeAbandonedTimeout="60" logAbandoned="true" />
> 
> 
> web.xml
> 
> 
> <resource-ref>
> 
> <description>DB Connection</description>
> 
> <res-ref-name>jdbc/myserver</res-ref-name>
> 
> <res-type>javax.sql.DataSource</res-type>
> 
> <res-auth>Container</res-auth>
> 
> </resource-ref>
> 
> 
> In my code, I use a javax.sql.DataSource object to get connections and call
> connection.close() to return connections.
> 
> 
> How do I get stats on the connection pool? I would like to check how many
> connections are active/idle at any point in time.
> 
> 
> Thanks,
> 
> Dhiren
> 

-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shif...@yale.edu

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to