[ASK} Is there an event to notify when connection lost ?

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
coliv_aja
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 04.08.2011, 09:04
Contact:

[ASK} Is there an event to notify when connection lost ?

Post by coliv_aja »

hi...
is there any event for detect if sometime connection lost,..
i'm using zeos 7 and mysql.
meltoywerks
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 10.06.2011, 04:42
Location: Dumaguete City, Philippines

Post by meltoywerks »

try this it worked for me

try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
coliv_aja
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 04.08.2011, 09:04
Contact:

Post by coliv_aja »

meltoywerks wrote:try this it worked for me

try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
no, i mean notify if successfully connection got lost unexpected, your code will drop the connection, on idle thats maybe usefull, but if on edit, it will lost data...
i have figure it out with function ping or pingserver...
what i wanted if there any event if connection lost, like unidac, event onlostconnection...
now i have been using thread to monitor connection every few second, lot of time to create syncronizing method on all interface because annoying invalid window handle..
but nevermind i have done...

thanks for reply...
meltoywerks
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 10.06.2011, 04:42
Location: Dumaguete City, Philippines

Post by meltoywerks »

ur welcome.
anyway, what is your purpose of monitoring your connection?
coliv_aja
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 04.08.2011, 09:04
Contact:

Post by coliv_aja »

sure, to notify if connection lost unexpected, like internet drop, or server dead...
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Have you tried ZConnection.PingServer?
amoarg69
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 25.10.2011, 00:18

Post by amoarg69 »

HI! didi you solve the problem? I have ezxactly the same

please, tell me, its zeos dead?

anyway, what is your purpose of monitoring your connection?[/quote]
Locked