"Betty Trakimas" <[EMAIL PROTECTED]> wrote on 11/22/2005 11:08:51 AM:

> Hello,
> 
> We just upgraded from 3.23.58 to 4.0.24. Our database connection, which 
can 
> remain open for a very long time, is timing out after being idle 
overnight, 
> where it never had in 3.23.58.  I learned from the manual that there is 
a 
> global variable WAIT_TIMEOUT, which appears to be set at 28800 seconds 
(8 
> hrs) by default.  I can set this value to some larger amount, say 7 
days, 
> but that may not be long enough depending on how our customers use our 
> product. In version 5.0.13 I can call mysql_options() with 
> MYSQL_OPT_RECONNECT set to true to enable automatic reconnection to the 
> server if the connection has been lost. I think this is really what I 
want 
> to do instead of setting the WAIT_TIMEOUT variable to a large value.  Is 

> there any way to set this reconnect flag in the 4.0.24 version 
> programatically? How?
> 
> Betty
> 

Any application that depends on a connection to another application in 
order to function correctly should be robust enough to deal with the 
temporary or permanent loss of that connection without causing too much of 
a problem. It doesn't matter what kind of other application your 
application needs to connect with, if it cannot handle a loss of 
communications without breaking it is poorly designed.

The reconnect flag is part of the client (your application) and how it 
makes its connection to the MySQL server. RTFM for the specific library 
your application is using for it's MySQL connectivity. It will have 
details on how to manage that flag.

Most server-friendly applications only make connections when they need 
something. Tying up a network socket overnight for little or no traffic 
just wastes server-side resources. I am not recommending a new connection 
for EVERY query, once per process is generally enough. I am recommending 
that you look at your original application's design and fix it so that 
your users won't complain every time it loses connectivity with the 
database on the back end. There are more causes of LOC (loss of 
communication) other than the server reaching it's timeout value so fixing 
that will improve the overall reliability of your application.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to