Hello,
I would like recognize if I can connect to MySQL database.
I am using something as that:
try
SQLConnection.Open;
except
On ESQLDatabaseError do
begin
ShowMessage('I can not connect to database');
Application.Terminate;
end;
end;
But often it works not, especially in debug mode, and ESQLDatabase error is shown.
I continue:
if SQLConnection.Connected then
begin
Query.Database := SQLConnection;
SQLTransaction.Database := SQLConnection;
Query.Close;
SQLTransaction.Active := True;
FormTexty.DataSource1.DataSet := Query;
Query.Close;
//Query.PacketRecords:=-1;
Query.SQL.Text :=
'Select * From vysledek';
Query.Open;
Debugln('*** Program started ' + RRRRMMDD(now));
end
else
begin
ShowMessage('I can not connect to database 2.');
Application.Terminate;
end;
And again sometime it works but mostly especially in debug mode not.
Seems to me that I have some problem with timeout on
SQLConnection.Open ?
Thank you for any clarify, advice..