How to keep the connection constant with the server?

0

I have an application made entirely in python where it connects to a server ...

import MySQLdb

db = MySQLdb.connect(host = '...' , user = '...' , passwd = '...' , db = '...' )  

The connection is done well as long as the system is used constantly if the system is stopped for two minutes the connection is lost and this error is generated:

  File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 202, in execute
self.errorhandler(self, exc, value)
  File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
  _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')

The question is how I can correct this error and that the connection to the database is constant

I would appreciate your input .. Thanks

    
asked by Faustino Velasquez 24.10.2018 в 23:11
source

0 answers