• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

connection pool in UDB does not close connections

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are getting connections from the pool and closing them after we done, which releases connections to the pool. But even after the application is closed connection to UDB is still exist. Does anybody experience this?

[ May 02, 2003: Message edited by: Irene Loos ]
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is this DBHelper thing? If it's a homegrown connection pool then it's not at all unlikely that it doesn't properly clean up on application shutdown -- if this is the case, I'd recommend using one of the many solid open-source pools such as Apache Jakarta DBCP (really, a connection pool these days should offer a DataSource interface, connections should be returned simply by closing them, and the implementation should leverage the driver's pooling support whenever possible).
Another possible source of problems is that your database clean-up code is broken. Specifically, if rs.close() throws an exception then the statement won't be closed. If either rs.close() or stmt.close() throws an exception then the connection won't be returned to the pool.The above is a watertight way to ensure that ResultSet and Statement are closed and the connection goes back into the pool. It makes use of the fact that closing a Statement will also close any ResultSet that might be open.
A completely unrelated issue that I couldn't help but notice is that you catch Exception (often a bad idea born out of lazyness) and re-throw it as a DAOException (fine) throwing away all stack trace information. That is going to make your debugging life a misery at some point. Why not properly wrap your root exception? If you're using JDK 1.4, use the Exception constructor that takes a Throwable cause. If you're using JDK 1.3 or earlier, write your own Exception root class along the following lines:Hope this helps
- Peter
 
Irene Loos
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Peter. I will try this out.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic