Hi,
I have been wondering why connections to MySQL get closed after some period of idle time.
Is this due to some timeout setting on the MySQL server?
What is the best way to handle a "timeout based" disconnect? I know there is a OnConnectionLost event, but documentation is rather scarce on this subject.
Best regards.
Connection timeout reason
-
DemetrionQ
- Devart Team
- Posts: 271
- Joined: Wed 23 Jan 2013 11:21
Re: Connection timeout reason
Hello.
There is a MySQL system variable - wait_timeout - it determines the number of seconds the server waits for activity on a noninteractive connection before closing it
http://dev.mysql.com/doc/refman/5.0/en/ ... it_timeout
To process connection lost you can handle the TMyConnection.OnConnectionLost event.
For that you should set the TMyConnection.Options.LocalFailover option to True.
TMyConnection.OnConnectionLost event handler has the RetryMode parameter that defines the behaviour after connection lost.
The additional information about using the OnConnectionLost event handler can be found in the article "Working in an Unstable Network" of the MyDAC documentation. Also you can find the description of the LocalFailover property, the OnConnectionLost event and the TRetryMode enumeration in the MyDAC documentation.
Also you can look at the example of handling the OnConnectionLost event in the Miscellaneous\FailOver demo.
There is a MySQL system variable - wait_timeout - it determines the number of seconds the server waits for activity on a noninteractive connection before closing it
http://dev.mysql.com/doc/refman/5.0/en/ ... it_timeout
To process connection lost you can handle the TMyConnection.OnConnectionLost event.
For that you should set the TMyConnection.Options.LocalFailover option to True.
TMyConnection.OnConnectionLost event handler has the RetryMode parameter that defines the behaviour after connection lost.
The additional information about using the OnConnectionLost event handler can be found in the article "Working in an Unstable Network" of the MyDAC documentation. Also you can find the description of the LocalFailover property, the OnConnectionLost event and the TRetryMode enumeration in the MyDAC documentation.
Also you can look at the example of handling the OnConnectionLost event in the Miscellaneous\FailOver demo.
-
jmuehlenhoff
- Posts: 36
- Joined: Fri 30 Apr 2010 11:25
Re: Connection timeout reason
Thank you, that's going to be helpful.
-
DemetrionQ
- Devart Team
- Posts: 271
- Joined: Wed 23 Jan 2013 11:21
Re: Connection timeout reason
If any other questions come up, please contact us.