To your mysql Resource definition below I would add
validationQuery="SELECT 1"

That should prevent your application from getting handed stale db
connections from your pool.  Take a look at the testOnBorrow and
validationQuery definitions here
http://commons.apache.org/dbcp/configuration.html

Jason



On Wed, Oct 6, 2010 at 8:18 PM, Steve Ryder <sry...@jsrsys.com> wrote:

> I am getting this during mysql connection (about once a week).
> I have read the thread on MySQL forum, which has a "solution", but the link
> to the solution is broken and points back to the same page.
> Suggestions have been use autoconnect=true
> Another was that the server timeout was shorter than the connection
> time-out.
> I have the following:
> In server.xml:
> <Connector port="80" maxHttpHeaderSize="8192"
>              maxThreads="192" minSpareThreads="32" maxSpareThreads="128"
>              enableLookups="false" redirectPort="8443" acceptCount="128"
>              connectionTimeout="20000" disableUploadTimeout="true" />
> In context.xml
> <Resource name="jdbc/MySql" auth="Container" type="javax.sql.DataSource"
>  url="jdbc:mysql://localhost.localdomain/rsa?autoReconnect=true"
>    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>  driverClassName="com.mysql.jdbc.Driver"
>  password="jsrsys" username="jsrsys"
>    maxWait="10000"   maxActive="200"  maxIdle="5"
>  removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true"
> />
> Note that maxWait is 1/2 of connectionTimeout and I have
> autoReconnect=true.
> Any ideas.   This is low priority as users are able to reconnect by just
> pressing Refresh, but I would like this to go away.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to