-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Trouble with validateQuery
PostPosted: Thu Mar 12, 2015 7:15 pm 
Newbie

Joined: Thu Mar 12, 2015 7:10 pm
Posts: 2
Location: Chicago
Hello
This is my first post to a board here so I hope I am providing enough infromation.

I am running a complex Tomcat Application and in my server XML file I have a resource like this.

Code:
<Resource auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver"
maxActive="10" initialSize="3" maxIdle="10" minIdle="10" name="jdbc/LiferayPool" password="password" type="javax.sql.DataSource"
maxWait="10000"   url="jdbc:oracle:thin:@localhost:1521:xe" username="upointLiferay_5103"
testOnBorrow="true" validationQuery="SELECT 1 from DUAL"  validationInterval="600000"
/>


My hope was that it would run the validation query when ever I check a connection out of the pool. Instead it runs the query thousands of times. I noticed that even if I put testOnBorrow=false, it still executes the queries. It seems to be doing it once before every SQL call instead of doing it once every 60 seconds per connection. My goal is to automatically get rid of connections that were invalidated by unscheduled database outages. I'm hoping it's jsut something silly I'm doing but can't seem to figure it out.

I played with the min and max active/idle connections thinking the pool was reaching 0 thus treating every connection like a brand new one.

Any thoughts?


Top
 Profile  
 
 Post subject: Re: Trouble with validateQuery
PostPosted: Fri Mar 13, 2015 9:30 am 
Newbie

Joined: Thu Mar 12, 2015 7:10 pm
Posts: 2
Location: Chicago
Apparently my application is using the default Apache commons dbcp pooling which does not support validation intervals nor does it recognize the testOnBorrow attribute. If a validationQuery exists, it assumes testOnBorrow="true". However without a validationInterval, every borrow of a connection will execute the validation query which is a real problem if your application runs on clusters and runs millions of SQL. I'm going to take a look at the risk vs reward of moving to
org.apache.tomcat.jdbc.pool instead of Apache dbcp. If anyone has any advice, quick setup instructions or thoughts they'd like to share, I'm all ears.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.