For test, I put:
Code: Select all
showmessage('test');Next, In services, I stopped MySQL service and showmessage doesn't appear.
Why ?
Code: Select all
showmessage('test');Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
myconnection1.Connect;
end;
procedure TForm1.MyConnection1AfterDisconnect(Sender: TObject);
begin
showmessage('test');
end;
procedure TForm1.MyConnection1ConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
showmessage('test');
end;
procedure TForm1.MyConnection1Error(Sender: TObject; E: EDAError;
var Fail: Boolean);
begin
showmessage('test');
end;In your work?eduardosic wrote:Set MyConnection.Options.LocalFailOver := True
and use the OnConnectionLost Event.
Code: Select all
procedure TForm1.MyConnection1ConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
showmessage('test');
end;Code: Select all
if myconnection1.Connected then
showmessage('why connected ?');8. D2009 + MyDAC v5.80.0.47C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Forcing close of thread 4 user: 'xx'
C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Forcing close of thread 3 user: 'xx'
C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Forcing close of thread 1 user: 'xx'
Code: Select all
MyConnection.Connect;
ShowMessage( 'Please, stop MySQL Server and press OK to continue.' );
MyQuery.Close;
MyQuery.SQL.Text := 'Select Version()' ;
MyQuery.Execute; // Ok on this point. LostConnection is called..
//Lost Connection Happen when yoy try a comunication with server.
Code: Select all
procedure TForm1.MyConnection1ConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
showmessage('t');
end;Code: Select all
procedure TForm1.MyConnection1ConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
RetryMode := rmRaise;
//Own procedure of reconnect
end;