*
The moose likes JDBC and the fly likes Connection pool - running out of connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection pool - running out of connections" Watch "Connection pool - running out of connections" New topic
Author

Connection pool - running out of connections

hamid hussain
Greenhorn

Joined: Aug 10, 2005
Posts: 2
hi,

We are using JConnect 5 and JDK 1.5 in our application. We
use connection pool to get the connection and close the
connection after using it by con.close(). But appraently the
connections are not getting closed and we can see lots of DB
connections in the syabse server. Due to this we are running
out of user connections on syabse server. Can someone let
me know what could be wrong. We are using Adaptive Server
Enterprise/12.0. The same code was working fine with JDK 1.3.1.

Thanks
Hamid
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
You must do these things in your method.

1. Use a local variable for your Connection.

2. Ensure that your JDBC objects are closed in the finally block.

3. Handle each close by closing the ResultSet, Statement and Connection in their own try/catch block.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
hamid hussain
Greenhorn

Joined: Aug 10, 2005
Posts: 2
hi,

this piece of code was working fine with JDK 1.3.1 and we are closing the DB objects. Only when we recently migrated to JDK1.5 did this issue come up.

Regards
Hamid
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection pool - running out of connections