Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection pool - running out of connections

 
hamid hussain
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
hamid hussain
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic