tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: OT: db pool problems - jdbc connection count?
Date Thu, 30 Oct 2003 19:30:15 GMT

You can write a bit of code to do this:

- Create an InitialContext
- Get the java:comp/env context
- Lookup your connection pool by JNDI name
- Cast your connection pool to the appropriate type as specified in your

Then you can call the implementation-specific method, e.g.
getNumActive() / getNumIdle() for
org.apache.commons.dbcp.BasicDataSource, to look at values.

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: Oscar Carrillo []
>Sent: Thursday, October 30, 2003 1:18 PM
>To: Tomcat Users List
>Subject: Re: OT: db pool problems - jdbc connection count?
>How about just watching the processes for postgresql while you access
>ps auxw | grep "postgres"
>On Thu, 30 Oct 2003, john-paul delaney wrote:
>> Hello List...
>> Sorry if this is off-topic.  Although I think I'm following the
>> jndi-resources-howto fairly well, I find I'm running out of
>> and I have to restart tomcat to free them up.  I'd like to know how
>> jdbc connections are in use at any given time with the intention of
>> finding the offending servlet(s).  I'm using postgreSQL.  I've
>> and looked at the postgres user lists but not found an example on how
>> detect the current number of connections in use.  Can anyone help?
>> tomcat 4.1.24
>> postgresql 7.3.3
>> pg73jdbc3.jar
>> commons-pool 1.0.1
>> I believe I'be been pretty thorough in closing down resultsets,
>preparedstatements and connections after use, and use the
>parameter in the DataSource Resource section of server.xml.
>> Any leads are much appreciated.
>> thanks
>> /j-p.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message