Re: ZMySQLDA thinks that MySQL has gone away

"Jonathan" <[email protected]> Mon, 26 Mar 2007 18:10:18 -0400
Newsgroups gmane.comp.web.zope.database
Message-ID <001c01c76ff3$8a650200$677ba8c0@DESKTOP>
----- Original Message ----- 
From: "Pedro León López" <[email protected]>
To: <[email protected]>
Sent: Monday, March 26, 2007 5:56 PM
Subject: [Zope-DB] ZMySQLDA thinks that MySQL has gone away


> Hello,
>
> I got this error when querying MySQL 5.0.26. I use Zope 2.9.4 and ZMysqlDA
> 2.0.9b3 (with MySQLdb 1.2.1_p2). MySQL do not gone away.
> This error only happens after exactly 8 hours of database inactivity. I
> found some information about this error.
> It seems is caused because MySQL close the connection after 8 hours, this
> time is stored at 'wait_timeout' system variable in the MySQL server.
> I'm doing an application for school where isn't there activity at night.
> Then db.py don't know this because it feels that connection is alive. 
> Maybe
> the solution is check the connection before db.query.

Very easy to create a simple DTML routine which accesses MySQL;  then set up 
a cron job to run that DTML routine every few hours.


Jonathan