RE: JBoss keeps sending select 'hello' from dual
Date: Wed, 29 Oct 2008 09:13:08 +0100
Message-Id: <0MKwtQ-1Kv6At2dTq-0007Fv@mrelayeu.kundenserver.de>
Hello,
> Well, what we tried was swapping out
>
> <check-valid-connection-sql >select 'hello' from dual
> </check-valid-connection-sql >
> for
> <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.
> vendor.OracleValidConnectionChecker</valid-connection-checker-class-name
> -->
>
> 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
is valid?
Restart of a database? Failover scenario?
I'm using a idle-timeout (jboss datasource) property, e.g:
<idle-timeout-minutes>15</idle-timeout-minutes>
After a connection hasn't been used for 15 minutes it gets closed. This
makes - in my case -
a valid connection check obsolete.
Cheers,
Martin
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Oct 29 2008 - 03:13:08 CDT