• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

refreshing a connection

Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am tring to refresh a Connection without closing it phsically from db.
We are using a simple connection pool(hand-made ,and not mine )
How can i do that with out creating a new connection?

I googled for it in the net and in this site ;


They say ;

"Closing a connection instance that was obtained from a pooled connection does not close the physical database connection. It does, however, free the resources of the connection instance, clear the state, close statement objects created from the connection instance, and restore the defaults for the next connection instance that will be created."

When i saw that i felt so happy then.

But at the next paragraph says;

"To actually close the physical connection, you must invoke the close() method of the pooled connection..."

I am confused.

How can i refresh a connection resources without reopening a new Connection to db?

Thank you.
[ June 01, 2006: Message edited by: sinasi susam ]
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off :

We are using a simple connection pool(hand-made

All bets are off anything you read about other pools. You have to know how your pool behaves. If you are using any of the classic pools such as JNDI DataSource pooling, when you ask for a connection, you actually get a wrapped Connection. It's the Wrapper that returns the internal Connection to the pool on close() now if close() is called on the wrapped connection, it does physically close it.

If by refreshing the connection, you mean cause it to release any DB resources that may not have been cleaned up due to sloppy coding, there isn't any way. You must physically close the connection and create a new one. If you refactor your pool you can have it periodically close connections in the background and add new (Fresh) connections to the pool.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic