MyConnection.ping as function

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Frega
Posts: 8
Joined: Thu 23 Apr 2009 18:44

MyConnection.ping as function

Post by Frega » Thu 25 Jun 2009 16:48

why you don't put myconnection.ping as function? returning the latency of the server like Smallint: 30 40 50 (ms)?


a question: i have a server with timeout 15secs, i can't change it because is a big host, lots of DBs...
to keep the connection alive im using a TTimer... every 7seconds i send a MyConnection.ping, but eventually, one or two times a day i get an connection lost error...
what to do about it? i tried the "DissconectedMode := true" but it does not work for me


im using in my project MyDAC 5.70 Std.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: MyConnection.ping as function

Post by eduardosic » Fri 26 Jun 2009 00:11

Frega wrote:why you don't put myconnection.ping as function? returning the latency of the server like Smallint: 30 40 50 (ms)?


a question: i have a server with timeout 15secs, i can't change it because is a big host, lots of DBs...
to keep the connection alive im using a TTimer... every 7seconds i send a MyConnection.ping, but eventually, one or two times a day i get an connection lost error...
what to do about it? i tried the "DissconectedMode := true" but it does not work for me


im using in my project MyDAC 5.70 Std.
Hi Frega, you need to use LocalFailOver

Set in TMyConnection.Options.LocalfailOver = True

in OnConnectionLost Event insert the code

Code: Select all

  RetryMode := rmReconnectExecute;
it's work fina and avoid Lost Connection.

you can see MyDAC Demo.. it's have a full demo of LocalFailOver and Disconnected Model.

Post Reply