This is a discussion on Connection timeouts within the MySQL Database forums, part of the Database Forums category; Hi all. I have a couple of serverprograms running on my Linuxbox that has a connection open to a MySQL (...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all. I have a couple of serverprograms running on my Linuxbox that
has a connection open to a MySQL (5.0.18) database. These serverprograms doesnt work much :-), they get called by clients once in a while, sometimes it can be days between they have to do any work. When they are started they connect to the MySQL database and then they wait for a client to connect to them and command the server to work vs the database. So, I want the connection to stay alive all the time, but this seems a bit hard...I have tried to set the MYSQL_OPT_RECONNECT to true before issuing the 'mysql_real_connect' call (I'm using the C-api) but that doesnt seem to work. The servers gets the "--:*MySQL server has gone away" back after a while. Is there a way to keep a connection alive for a *very* long time if desired ? Thanx /ZW |
|
|||
|
You have to set up a timer on your clients app to ping the server
automatically every time you are close to the timeout setting of the server. "ZoombyWoof" <zoombywoofremove@thishotmail.com> wrote in message news:Gn4Kf.5502$zc1.3520@amstwist00... > Hi all. I have a couple of serverprograms running on my Linuxbox that has > a connection open to a MySQL (5.0.18) database. These serverprograms > doesnt work much :-), they get called by clients once in a while, > sometimes it can be days between they have to do any work. When they are > started they connect to the MySQL database and then they wait for a client > to connect to them and command the server to work vs the database. So, I > want the connection to stay alive all the time, but this seems a bit > hard...I have tried to set the MYSQL_OPT_RECONNECT to true before issuing > the 'mysql_real_connect' call (I'm using the C-api) but that doesnt seem > to work. The servers gets the > "--:*MySQL server has gone away" > back after a while. > > Is there a way to keep a connection alive for a *very* long time if > desired ? > > Thanx > > /ZW |
|
|||
|
SEE -> http://dev.mysql.com/doc/refman/5.0/en/mysql-ping.html
--B "ZoombyWoof" <zoombywoofremove@thishotmail.com> wrote in message news:Gn4Kf.5502$zc1.3520@amstwist00... > Hi all. I have a couple of serverprograms running on my Linuxbox that has > a connection open to a MySQL (5.0.18) database. These serverprograms > doesnt work much :-), they get called by clients once in a while, > sometimes it can be days between they have to do any work. When they are > started they connect to the MySQL database and then they wait for a client > to connect to them and command the server to work vs the database. So, I > want the connection to stay alive all the time, but this seems a bit > hard...I have tried to set the MYSQL_OPT_RECONNECT to true before issuing > the 'mysql_real_connect' call (I'm using the C-api) but that doesnt seem > to work. The servers gets the > "--:*MySQL server has gone away" > back after a while. > > Is there a way to keep a connection alive for a *very* long time if > desired ? > > Thanx > > /ZW |