avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: JdbcDataSource question
Date Mon, 07 Jan 2002 13:55:13 GMT
Charles Yates wrote:

>      I have a small server built using Avalon. (my thanks to everyone
> for making life easy with this fine framework).  Recently the database
> that this server connects to has gone down and back up again. My server
> stops working when this happens.  Is it possible to configure
> JdbcDataSource in a way that will handle this event, or do I need to
> take care of it in my own code?


Make sure you are taking advantage of the Keep-Alive query function.
When you supply an entry like this in your configuration:

<pool-controller min="2" max="30" grow="4">
   <keep-alive>SELECT 1 FROM DUAL</keep-alive>
</pool-controller>

It will execute the query prior to giving the connection to you so that
you will always get a valid connection.

Unfortunately the same query doesn't work for everything.

SELECT 1;  works for many databases, just about all the open source ones,
and a few others.

SELECT 1 FROM DUAL; works for Oracle.

Some databases like Informix requires that you provide a query against
an existing table in your database.  Use something guaranteed to return
one value--preferably "SELECT 1 FROM mytable;" or something like that.




-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message