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]