Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-18-2007, 07:10 PM
flarosa
 
Posts: n/a
Default Problem validating connections from connection pool

I'm using MySQL on a Tomcat server with the DBCP connection pool.

I'm having trouble setting up the connection pool such that it will
validate connections. I initialized the connection pool object in an
xml file like this -

<bean id="my-datasource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-
method="close">
<property name="driverClassName"
value="com.mysql.jdbc.Driver" />
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="4"/>
<property name="maxActive" value="400"/>
<property name="maxIdle" value="40"/>
<property name="poolPreparedStatements" value="true"/>
<property name="validationQuery" value="select 1"/>
<property name="testOnBorrow" value="true"/>
</bean>

To test it, I start Tomcat and run a few queries. Then I stop and
restart my MySQL server, then I try to run the queries again. What I'm
expecting to happen is that the connection pool will realize that the
old connections don't work again and discard them before they're ever
returned to my application. Instead, my application gets the bad
connections and errors out trying to use them. This happens
indefinitely until I restart Tomcat.

I also tried using a query that actually queries a real table in my
database, but that did not help.

Is there something wrong with my configuration? This seems like a
pretty simple and straightforward thing that should work with no fuss.

Thanks,
Frank

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:47 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.