[Gambas-user] MySQL connection gone away, how to re-establish?

Willy Raets willy at ...2734...
Fri Sep 6 16:25:04 CEST 2013


On Fri, 2013-09-06 at 16:11 +0200, Benoît Minisini wrote:
> 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.

Hi Benoît,

If you would integrate this into the database driver, then could this be
made:
1. Optional (so you can enable or disable the closing and reopening of
the connection)
2. With a configurable time interval that defaults to an hour for
example, but can be set to other intervals as well.

-- 
Kind regards,

Willy (aka gbWilly)

http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org








More information about the User mailing list