Hi Armin,

now I changed to current version from OBJ 1.0 rc2 to rc3.
The problem after restart the connected database still exists.

This is my configuration for connection-pool
        <connection-pool
            maxActive="21"
            maxIdle="5"
            testWhileIdle="true"
            testOnBorrow="true"
            whenExhaustedAction="2"
            timeBetweenEvictionRunsMillis="10000"
            minEvictableIdleTimeMillis="10000"
            numTestsPerEvictionRun="5"
            validationQuery="select 1 from dual"
        />

I got following errormessage:

[org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: Io
exception: Connection reset by peer: socket write error
java.sql.SQLException: Io exception: Connection reset by peer: socket write
error
....

[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
....

I think that 'validationQuery' is not enough, because this method is only
called if a broker will be borrowed from pool. In my current implementation
I create a PB during servlet startup and save it in a MyDatabaseServiceImpl
in ServletContext. So I only can catch exceptions from broker if
databaseaccess fails. If this exception occures, there should be a way to
reinitialize ConnectionFactory, maybe with PersistenceBrokerFactory.reset()
or .refresh(). If the problem still exists after 'reset()', ok, then there
is no connection to the database.

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/o
> jb/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]
>

Reply via email to