Hi... there are two issues here: does the pool timeout if it can't get to the database? and do clients timeout if they cannot acquire a Connection in a reasonable time?
The latest (still prerelease) versions of c3p0 allow fairly complete control over all this stuff. (If you can, wait 'til the weekend, when the next prerelease will be released on sourceforge. I have one more TODO to take care of. If you can't wait, e-mail me at
swaldman@mchange.com for the current development snapshot.)
Re the interaction between the pool and the database, there are 3 new config params:
c3p0.acquireRetryDelay -- milliseconds. if the pool fails to acquire a connection from the DB, how long does it wait before it tries again?
c3p0.acquireRetryAttempts -- number. how many times will the pool try, fail, and delay the time period set above, before the pool gives up and throws an Exception to any Connection waiting on a Connection?
c3p0.breakAfterAcquireFailure -- true or false. if a pool goes through a whole round of trying to acquire database Connection using the parameters above, then fails, should it consider itself permanently broken, or be willing to retry all over again when it receives new client requests?
Re the interaction between clients and the pool (BUT wait 'til Monday or write me -- not yet in current sourceforge release -- first public release with this config will be c3p0-0.8.5-pre7):
c3p0.checkoutTimeout -- milliseconds. how long will a client will wait for a Connection from the pool before giving up and seeing an SQLException? clients wait for a Connection either because the pool is trying to acquire more Connections from the database, or because the pool has reached its maximum size and all Connections are checked out, so the pool is waiting for other clients to return connections.
Please note these properties cannot be changed in hibernate's config's file, but you must use c3p0's native config tools, such as a c3p0.properties file. See
http://forum.hibernate.org/viewtopic.ph ... highlight= for more on this.