If the database or network goes down when OJB already has connections in the underlying pool, I've found that OJB does not recover when the database comes back up. I think this is because after an operation fails the invalid connection is returned to the pool rather than being destroyed and a new one created.

Using the built-in connection pool ConnectionFactoryConPooledImpl I tried setting "testOnBorrow" to true in the connection-pool element of jdbc-connection-descriptor, but this did not help. Looking at the code, ConnectionFactoryConPooledImpl.validateObject() just calls java.sql.Connection.isClosed(), and this does not seem to detect that the connection is invalid, at least for the JDBC drivers for Postgresql and Oracle that I'm using.

Then, I noticed that the current CVS version (0.9.8) offers a ConnectionFactoryDBCPImpl option in OJB.properties. Using the Jakarta DBCP connection pool directly in another application, I've found that you can get robust behaviour by setting testOnBorrow to true and setting a suitable validation query (e.g. select 0 from dual for Oracle). However, it seems that OJB sets the validation query to null. (A comment suggests this is because a suitable validation query would vary between database platforms). And there does not seem to be a configuration option to set/override the validation query ...

I'd be grateful for any suggestions.

John.


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to