cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: MySql connection timeout
Date Tue, 31 Mar 2009 11:43:46 GMT
The default timeout is not 8 hours, but something much shorter (like 5  
minutes). Both client and server side settings effect that. Cayenne  
does NOT do anything to reconnect by itself, so usually you'd see it  
pretty quickly. It does depend on your pool configuration though. E.g.  
if you set it to reopen a connection every time, obviously no timeouts  
will occur. So no idea why you can't reproduce it, but DataSource  
configuration is the place to start with.

The link that Andrey provided is a bit dated. To autoreconnect under  
MySQL you need a bit more effort:

1. URL parameters: connectTimeout=0&autoReconnect=true
2. Validation query. Believe it or not, #1 above is not enough to  
prevent errors. You also need a validation query, which can be set if  
you are using a DBCP connection pool. Here is a link explaining how to  
set it on Tomcat:

http://confluence.atlassian.com/display/JIRA/Surviving+Connection+Closures

Andrus

On Mar 31, 2009, at 2:30 PM, Andrey Razumovsky wrote:

> This is a known problem, have a look at
> http://cwiki.apache.org/CAY/reconnect.html
>
> 2009/3/31 Dave Merrin <dmerrin@ipasystems.co.uk>
>
>> Hi,
>>
>> I've read about and understand that my application is having its  
>> connection
>> timed out after 8 hours of inactivity using MySql. I've set the  
>> timeout to
>> be 120 seconds so I can try and reproduce the error without waiting  
>> for 8
>> hours. Unfortunately I'm never seeing the problem. I connect, make  
>> some
>> queries, sleep for 3 minutes, then make some more queries. I never  
>> get the
>> timeout exception.
>>
>> Is Cayenne doing something behind the scenes?
>>
>> Cheers,
>>
>> Dave
>>
>>


Mime
View raw message