Hi John,
----- Original Message ----- From: "John Holman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 2:23 PM Subject: OJB not robust against database or network failures > 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 ... Yes, you are right I checked in this version a few days ago. I'm not a DB-expert, so I don't now what's the best solution to get the 'validationQuery' from. 1. Use a hard-coded query from the Platform implementation class 2. Allow user to set the query within the jdbc-connection-descriptor in the repository file. Any comments welcome. regards, Armin > > I'd be grateful for any suggestions. > > John. > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>