Hi Scott,
Scott C. Gray wrote:
> We are currently nearing completion of a core component
> of our environment, utilizing just the PB portion of OJB.
> This component is vital to our infrastructure and as such
> must be highly available. The previous, pure JDBC,
> version had all sorts of logic to attempt to re-establish
> database connections when they fail (that is, we could
> bounce/lose our database server without worrying about
> this component).
>
> My question is, are there is tips, tricks, concerns, or
> any other general information on attempting to achieve
> the same functionality with the PB. I suspect the answer
> lies in the connection factory--if so, is there a
> recommended way of utilizing it to get the desired
> behavior?
>
This kind of sanity check is done in
org.apache.ojb.broker.accesslayer.ConnectionManager
before handing out a Connection to other component it checks wheter the
connection is alive:
/**
* Check if underlying connection was alive.
*/
public boolean isAlive(Connection conn)
{
try
{
return con != null ? !con.isClosed() : false;
}
catch (SQLException e)
{
log.error("IsAlive check failed", e);
return false;
}
}
This is very simple and won't work properly for several jdbc drivers.
You might provide your own derived implementation.
I also want to have a fail-safe solution that will perform a check
against the OJB sequence-manager table to see if the db is still reachable.
There was a volunteer working on this but I have not seen any results yet.
cheers,
Thomas
> Thanks,
> -scott
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>