[Gambas-user] MySQL connection gone away, how to re-establish?
Benoît Minisini
gambas at ...1...
Fri Sep 6 16:11:30 CEST 2013
Le 06/09/2013 16:01, Alexie a écrit :
> Version 3.4.2 is used, and after reconnecting, the request will be retried
> too? Currently i see an error thrown.
>
This is a mysql client option.
When connecting to a mysql database, the Gambas mysql driver define the
MYSQL_OPT_RECONNECT option, that tells the mysql client to automatically
reconnect to the server if the connection is lost.
So normally you should not have the "connection lost" error message.
If, apparently, the mysql client does not respect its own options, you
will have to handle that yourself.
What I suggest is explicitly closing and reopening the connection from
time to time (for example each hour). I did that for my own application
because I got some errors too (but not the "connection lost" error,
something else) and I don't have problems anymore.
If you tell me that this solution works, maybe I will integrate it
directly into the database driver.
Regards,
--
Benoît Minisini
More information about the User
mailing list