db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject RE: Problems with Mysql timeout
Date Tue, 08 Feb 2005 15:52:52 GMT




Hi,

Yet another solution on the client side: Whether a connection timeout can
be configured depends on the connection pool you are using. If you are
using SharedPoolDataSource, it should be possible to tell the pool to close
unused connections after a certain period of time.  See the documentation
of the setters in
http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/datasources/SharedPoolDataSource.html

All of the setters can be addressed by setting the corresponding properties
in the Torque runtime.
The setters you need should be
http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.html#setTimeBetweenEvictionRunsMillis(int)
and
http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.html#setMinEvictableIdleTimeMillis(int)

The corresponding properties are e.g. (replace somedb with your db name)
torque.dsfactory.somedb.pool.timeBetweenEvictionRunsMillis = 10000
torque.dsfactory.somedb.pool.minEvictableIdleTimeMillis = 100000

     Thomas

"Matthew P. Reath" <matt.reath@cciinc.us> schrieb am 08.02.2005 16:07:49:

> I'm developing a web-based application using Tomcat/Torque/MySQL. The
> problem I run into is that after 8 hours of inactivity the persistent
> connection Torque uses becomes invalid and I get an exception. The next
time
> I try it works. After another 8 hours of idle time the process repeats.
>
> I searched the internet for answers but most of them involved good
> programming practice to handle this situation in one's own JDBC code, I
> however am using Torque.
>
> Is there a way to configure Torque to handle this timeout period? I'd
rather
> not depend on the connection always being there in case it was dropped
> because of network problems or what not. Ideally I would like Torque to
> reconnect anytime it's connection becomes invalid or do some sort of
> heartbeat.
>
> Thanks,
> Matt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message