I\'ve just started using BoneCP and pulled the sample JDBC code from the authors site.
I have a function called getConnection() that returns a connection here is a s
Connection connection = dbPool.getConnection();
The Connection object gotten from the pool, is a wrapper class. It will maintain the underlying connection properly even in the Exception.
Even in the Connection related exceptions, for example, TERMINATE_ALL_CONNECTIONS, the BoneCP pool will properly close all the underlying connections.
In summary, BoneCP pool make the cache transparent. Client side only need follow the stand flow,
When application stop, shutdown the pool to release all the cached connections.
boneCP.shutdown()
1. Always call connection.close()
to return the connection to the pool (it won't be physically closed) when you're done with it.
2. Call connectionPool.shutDown()
when you're completely done with the pool and not planning of reconnecting again.