tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Mysql timouts...
Date Thu, 22 Feb 2007 12:45:38 GMT
If you read through
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html,
you'll find the validationQuery attribute is used to test connections
before they are borrowed from the pool.  The query can be as simple as
"select 1".

As a side note, drop the autoReconnect=true from your database url. 
It's not recommended and actually does not prevent SQLExceptions on
connections that go stale.  It just restores the connection for the next
request after the exception.  The MySQL website has further information
regarding what autoReconnect actually does.  One of these days, the
tomcat docs should be updated to remove that.

--David

Jacob Rhoden wrote:

>
> Jacob Rhoden wrote:
>
>> I am having the seemingly common "Broken pipe" to mysql problem with
>> tomcat.
>>
>>  <Resource auth="Container" name="jdbc/blah" type="javax.sql.DataSource"
>>      maxActive="5" removeAbandoned="true"
>>      maxIdle="2" maxIdleTime="300" idleConnectionTestPeriod="60"
>>      maxWait="10000" username="blah" password="blah"
>>      driverClassName="com.mysql.jdbc.Driver"
>> url="jdbc:mysql://localhost:3306/blah?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf8"/>
>>
>>
> I have installed a most up to date version of tomcat 5.5.20/mysql5.0.4
> connector on Redhat Enterprise WS 4, and according to the mysqladmin
> tool, the connections are not used (remain in sleep mode for way more
> than the idleConnectionTestPeriod variable), which makes me think this
> configuration is invalid. Is there anyway to ensure tomcat
> tests/refreshes its database connections?
>
> Best Regards,
> Jacob
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message