RE: JBoss keeps sending select 'hello' from dual
Date: Wed, 29 Oct 2008 09:13:08 +0100
> Well, what we tried was swapping out
> <check-valid-connection-sql >select 'hello' from dual
> </check-valid-connection-sql >
> However that seems to generate an equal number of
> select 'x' from dual
> statements so I don't know that we've gained very much. Anyone have
> other suggestions?
It's a tradeoff.
Do you (really) need a connection valid check? If no, omit both check-valid-connection-sql
as well as valid-connection-checker-class-name. If you omit these, there is less traffic, on
the other side you could get sporadic errors.
If you need it - try to find a valid sql which consumes as less resources as
possible. I suppose
as "begin null; end;" might be cheaper in terms of resource usage than a select statement.
The next question you should ask: Why do you need to check if a connection
Restart of a database? Failover scenario?
I'm using a idle-timeout (jboss datasource) property, e.g:
After a connection hasn't been used for 15 minutes it gets closed. This
makes - in my case -
a valid connection check obsolete.