Hi guys,
This question should go to developers of DBCP package. Here is a code for
reallyClose() method of PoolableConnection class:
public void reallyClose() throws SQLException {
_conn.close();
}
The problem is that this method is called by PoolableConnectionFactory whenever
it destroys an object. Well, if the database is restarted, the method above is
going to throw an SQLException (Reset connection on Oracle). Always. This, kind
of, breaks the purpose of verifying connections for their validity. The logic is
the following: when borrowing a connection from the pool,
PoolableConnectionFactory (PCF) will check if the object is valid, the DB is
restarted so all valid connections are invalid (throwing exception), PCF then
will destroy them and allocate new ones, upon their destruction an exception is
thrown and not caught.
I recommend that _conn.close() be wrapped in an empty try/catch block. This way
the object is still removed from the pool, new connection is allocated, and no
exception goes to a client application. DB restarts and DBCP package work
together like magic. ;-)
What do you think?
Thanks,
Kyrill Alyoshin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]