Title: RE: [DBCP] Some questions

> 1) Clean shutdown.           

If you shutdown the VM cleanly (i.e., if you have an application that can actually exit all non-dameon threads), I think DBCP should give you a clean shutdown--all the database objects should be closed then released as part of the gc process.

> You never need to release connections made to the db server?
> 2) Recover from a bounced DB.

The pool does that for me.  Take a look at the GenericObjectPool configuration.  You can ask it to verify connections, to drop idle connections, etc. 

Although to be honest is I knew I was going to bounce the db, I'd probably bounce the app server also, rather than wait for the pool to "discover" the invalid old connections, but it will recover from the bounced db rather seamlessly on its own. (It'll do it much faster if you turn test-on-borrow on--then it will pick up the changed db immediately, but then you get an extra statement executed with each borrow.)

The clear method of ObjectPool is what you want to use, I think, if you want an event-driven way to drop all the connections in the pool.

Reply via email to