Page 1 of 1

MyConnection.ping as function

Posted: Thu 25 Jun 2009 16:48
by Frega
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.

Re: MyConnection.ping as function

Posted: Fri 26 Jun 2009 00:11
by eduardosic
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.