[ 
https://issues.apache.org/jira/browse/DBCP-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13903527#comment-13903527
 ] 

Bernd Eckenfels commented on DBCP-357:
--------------------------------------

I think it is good to have different validators. And JDBC4 isValid() can be one 
of them.

However I advice against using this at the only method. For Oracle drivers for 
example the isValid() method does internally use a sinple select statement (and 
it does actually NOT use a prepared statement). If a timeout is specified it is 
even worse at it kicks of a background thread (on each isInvalid(int) 
invocation). The Oracle implementation is therefore so bad (as of today), it is 
much better to use the sql method (with PS).

BTW: there might be some possibility for optimizations if you have a reset 
statement (like rollback() and setAutocommit()). If those are sent to the DB 
they can replace the valid check in some conditions.


> Connection validationQuery mechanism should be replaced by new method 
> connection#isValid()
> ------------------------------------------------------------------------------------------
>
>                 Key: DBCP-357
>                 URL: https://issues.apache.org/jira/browse/DBCP-357
>             Project: Commons Dbcp
>          Issue Type: Improvement
>    Affects Versions: 1.4, 1.4.1
>            Reporter: Philippe Mouawad
>              Labels: PERFORMANCE
>             Fix For: 2.0
>
>
> Hello,
> Current method of connection validation relies on validationQuery.
> This method has a rather big performance impact on the DB (CPU, for example 
> 3% with SELECT 1 FROM DUAL even with Oracle 10G FAST DUAL) and make an 
> additional query for each borrow (when testOnBorrow is true).
> Wouldn't it be better to use new JDBC 4 method isValid which relies on Driver 
> check ? (Oracle would for example use its internal method ping)
> Thank you
> Philippe
> http://www.ubik-ingenierie.com



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to