Hi James,

----- Original Message -----
From: "James Nyika" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2003 3:12 PM
Subject: RE: Handle broken database connections


> Armin
>  what happens when you set the connection pool to test connections
> using these flags ?

this will solve the problem

>
>
> <connection-pool timeBetweenEvictionRunsMillis="10000"
> minEvictableIdleTimeMillis="10000"  whenExhaustedAction="2"
> testOnBorrow="false" testWhileIdle="true" validation-query="select 1
> from dual"/>

testOnBorrow="false"
a typo?

only when set testOnBorrow="true" the validationQuery was used
see
http://nagoya.apache.org/gump/javadoc/jakarta-commons/pool/dist/docs/api
/

if set false the connection was returned from pool without
any validation operations.

>
>  If it finds dead connections
>    1. Does it drop them and reconnect them or just drop them ?

drop them from pool and try to get next connection from pool

>    2. If it just drops them, what happens when the broker goes to
> borrow from the pool and finds nothing in there.

then a new connection was created

the only problem with the current implementation is
that you could end up in a loop when
- your validationQuery is corrupted
- your DBMS is permanent down
then ConnectionFactory always try to create a new connection,
because the validationQuery fails (this is on my todo-list).
Need something like a counter that observe the validationQuery
attempts.

> Since the setting for
> "whenExhaustedAction" is set to GROW, will it at least create a
> connection thereby avoiding Reinhard's problem altogether ?

I think 'whenExhaustedAction' does not affect
'Reinhard's problem', because ConnectionFactory does not
remove the corrupted connections from pool by default (except
connection.isClosed() returns true), only when using
'validationQuery' feature. Mean using 'validationQuery'
suffice to avoid 'Reinhard's problem'.

>
>  just a thought.

just some more thoughts ;-)

regards,
Armin


>
>
> James Nyika
> Cambridge Technology Partners
> The global eServices company of Novell, Inc.
> http://www.novell.com
>
> >>> [EMAIL PROTECTED] 5/29/2003 8:41:24 AM >>>
> 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]
>
>
>



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

Reply via email to