number of connection in DataSource

F

finecur

Hi,

I am using PostgreSQL and tomcat connection pool. I found a lot of
lost connections in my applications. To debug this problem, I would
like to know how many connections I have established in my application
and how many are available in the pool. How can I get this
information? I am using the DataSource API.

To get a connection, I use myDataSource.getConnection();

To close a connection, I use myConnection.close();

Thank you very much.

fm
 
A

Arne Vajhøj

finecur said:
I am using PostgreSQL and tomcat connection pool. I found a lot of
lost connections in my applications. To debug this problem, I would
like to know how many connections I have established in my application
and how many are available in the pool. How can I get this
information? I am using the DataSource API.

To get a connection, I use myDataSource.getConnection();

To close a connection, I use myConnection.close();

Getting information out of the pool will require you
to sniff around inside the connection pools internal
structures.

I would attack it from the other side: are all connections
opened, assigned to a local variable and closed in a finally
block ?

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top