Hi.
If the pool is unable to Connect to the database over a period of time, eventually your application will see an SQLException thrown from client calls to getConnection(). For now, there is no easy way for your application to test whether the reason for the Exception was that c3p0 determined the database to be inaccessible -- an SQLException from getConnection() could have other causes.
To resolve this, the next minor revision of c3p0 (0.9.0-pre4) will set SQL State "08001" on SQLExceptions from getConnection() resulting from a down or inaccessible database. Thus your code can determine whether the database appears to be unavailable. (In general, be careful to test for null when checking the SQL state of SQLExceptions, because often no SQL state is set, and the state defaults to null.)
smiles,
Steve (c3p0 guy)
|