how to handle exception if MySQL server does not respond ?
Posted: 16.07.2008, 20:09
hi, i try this code:
function ConnectMySQL(iConexe: TZConnection; iIP: String; iDB : String): Boolean;
begin
Screen.Cursor := crSQLWait;
ConnectMySQL := False;
iConexe.HostName := iIP;
iConexe.Database := iDB;
try
iConexe.Connect;
ConnectMySQL := True;
except
on E:Exception do begin
showMessage('Cannot Conect' + Chr(10) + Chr(13) + E.Message);
end;
end; { except }
Screen.Cursor := crDefault;
end;
but if server is down, program crashes without any message
the same problem is when is missing libmysq.dll
any idea, what is wrong ?
thanx thom
function ConnectMySQL(iConexe: TZConnection; iIP: String; iDB : String): Boolean;
begin
Screen.Cursor := crSQLWait;
ConnectMySQL := False;
iConexe.HostName := iIP;
iConexe.Database := iDB;
try
iConexe.Connect;
ConnectMySQL := True;
except
on E:Exception do begin
showMessage('Cannot Conect' + Chr(10) + Chr(13) + E.Message);
end;
end; { except }
Screen.Cursor := crDefault;
end;
but if server is down, program crashes without any message
the same problem is when is missing libmysq.dll
any idea, what is wrong ?
thanx thom