RE: JBoss keeps sending select 'hello' from dual

  • From: "Martin Busik" <martin.busik@xxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 29 Oct 2008 09:13:08 +0100

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



--
//www.freelists.org/webpage/oracle-l


Other related posts: