Re: [Zope-DB] ZMySQLDA thinks that MySQL has gone away

2007-03-26 Thread Bill Campbell
On Mon, Mar 26, 2007, Pedro Le?n L?pez wrote:

   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.

Given that mysql (or any other database) may well be restarted as part of
log rotation and cron maintenance, you may well want to not depend on
continuously open connections.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``During times of universal deceit, telling the truth becomes
a revolutionary act.''  --George Orwell
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ZMySQLDA thinks that MySQL has gone away

2007-03-26 Thread Jonathan


- Original Message - 
From: Pedro León López [EMAIL PROTECTED]

To: zope-db@zope.org
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 


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db