Connection pooling
Status as of Nov 30 2005
We originally started with dbcp. However every morning after a night of inactivity we would get stale connections and a nasty exception screens. They would eventually go away after one or two refreshes.
This problem plus the fact that dbcp was no longer supported out of the box by hibernate, decided us to migrate c3p0 bundled in hibernate.
It worked great until we got in 0.7b1 reports of deadlock during data sampling scheduled job (we were using c3p0 0.9.0.2).
We have tried a long time to work with c3p0 and we still need to get help from them but at this point so close to 0.7 release, the safest route is just to switch back to dbcp and fix the stale connections problem. c3p0 does not seem to give us much advantage anyway.
DBCP
To make hibernate 3 work with dbcp we have to copy this code
Optimization
This is a good article on how to detect problems.
JInspired has a very nice tool to profile java application from UI down to SQL