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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top