Hi Armin currently I use OBJ in Version 1.0 rc2
Reinhard -----Original Message----- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 3:16 PM To: OJB Users List Subject: Re: Handle broken database connections Hi Reinhard, don't know which version of OJB you use (think it's an older version), but in current version something similar done when using 'validationQuery' attribute. See http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/ accesslayer/ConnectionFactoryPooledImpl.java What I mean is that we don't have a method to clean/refresh the connection-pool at runtime. PersistenceBrokerFactory.releaseAllInstances(); clean the PB-pool but does NOT affect the connection pool. So do you think we need a method to clean/refresh the used ConnectionFactory instance too (e.g. enhance PBF.releaseAllInstances to refresh ConnectionFactory too) - or does 'validationQuery' feature suffice? regards, Armin ----- Original Message ----- From: "Reinhard Dunst" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Thursday, May 29, 2003 2:41 PM Subject: RE: Handle broken database connections > Hi Armin, > > yes I think so. A 'refresh()' would make sense. Because there are a lot of > situations where the connection to the database can be lost. And when I look > in archive for similar situations, there are some of them. I saw, there is > just a 'connection.isClosed()' in > ConnectionFactoryConPooledImpl.validateObject() and a lost connection is > already open. And additionaly the connection will be checked only if a > broker will be borrowed. > > What do you think about my actual workaround? > > public void checkConnection() > throws MyConnectionFailException > { > try > { > // try a fast testquery like 'select 1 from dual' in oracle > .... > Object obj = broker.getObjectByQuery(query); > } > catch (Exception ex) > { > try > { > PersistenceBrokerFactory.releaseAllInstances(); > broker = PersistenceBrokerFactory.createPersistenceBroker(...); > } > catch (Exception ex) > { > throw new MyConnectionFailException(); > } > } > } > > Thanks in advance, > Reinhard > > > -----Original Message----- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 28, 2003 3:13 PM > To: OJB Users List > Subject: Re: Handle broken database connections > > > Hi Reinhard, > > ----- Original Message ----- > From: "Reinhard Dunst" <[EMAIL PROTECTED]> > To: "OJB-Users-List (E-mail)" <[EMAIL PROTECTED]> > Sent: Wednesday, May 28, 2003 1:13 PM > Subject: Handle broken database connections > > > > Hi, > > > > how can I handle broken database connections. If I shut down the > database > > and restart it, > > you could use the 'validationQuery' attribute within the connection-pool > element to check connection before it could be obtained from pool. > > currently we don't have a 'refresh()' method on ConnectionFactory > level to allow the implementation class to refresh their connection > pool - if con-pooling was supported. > Would such a 'refresh' method make sense? > > regards, > Armin > > > I get following errormessage occure: > > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: > > PersistenceBrokerException during > > the execution of the query: > > Io exception: Connection reset by peer: socket write error Io > exception: > > Connection reset by peer: socket write error > > java.sql.SQLException: Io exception: Connection reset by peer: socket > write > > error > > > > My current configuration is > > java 1.4.1 > > ojb 1.0 rc2 > > > > Thanks in advance > > Reinhard > > > > > > > > > ======================================================================== > ==== > > ========== > > Reinhard Dunst > > T.U.B. Technologie- & Unternehmensberatung GmbH > > > > mobile: +43.664 - 2525928 > > email: mailto:[EMAIL PROTECTED] > > > ======================================================================== > ==== > > ========== > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
