You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ian Hunter <Ia...@inovis.com> on 2004/06/02 16:26:57 UTC

DB Connections reset

I had the same problem with PersistenceBroker having issues if my
database reset or failed over, and for now I have a validationQuery set
up on the connection pool.

 

My first thought was to force the connections to reset with
PersistenceBrokerFactory.releaseAllInstances() but that still didn't
start working after the database came back online.  (I have fairly
centralized exception handling and it was trivial to say that any time I
got what I classified as a "fatal" PB exception, I would release all
instances.)

 

After reviewing the suggestions on the list, specifically the concept of
a pluggable connection validator class, something occurred to me to add
to the discussion.  My concern with any kind of validation would be the
excess SQL queries being run, and I was trying to come up with a way to
limit them.  

 

In my exception handling, I could set a flag that would mark that
connection as dirty. The validation class/plugin would simply exit if
the flag wasn't set; otherwise it could run a query for a set number of
calls, and then clear the flag.  That would certainly suffice for my
purposes.

 

Along those lines, one could even programmatically add a validationQuery
to the connection pool (I guess, haven't tried it yet) after a failure,
and wrap the calls to the PB API with a counter that would clear the
validationQuery after xxx number of successful accesses.

 

Food for thought...

 

Ian Hunter, Staff Consultant
ian.hunter@inovis.com

Inovis USA, Inc.
11720 Amberpark Drive
Parkway 400, Suite 300
Alpharetta, GA 30004-2271
Phone/FAX: 404.467.3285

 

This message is intended for the addressee(s) only and may contain
confidential

and/or proprietary information. If you have received this message in
error, please

notify the sender and destroy the message. Unauthorized use or
disclosure may

be unlawful.