Recent

Author Topic: MySQL Try SQLConnection.Open timeout problem?  (Read 738 times)

xaver13

  • Full Member
  • ***
  • Posts: 111
MySQL Try SQLConnection.Open timeout problem?
« on: March 30, 2020, 07:41:51 pm »
Hello,
I would like recognize if I can connect to MySQL database.

I am using something as that:
Code: Pascal  [Select][+][-]
  1.   try
  2.     SQLConnection.Open;
  3.   except
  4.         On ESQLDatabaseError do
  5.            begin
  6.              ShowMessage('I can not connect to database');
  7.              Application.Terminate;
  8.            end;
  9.   end;  

But often it works not, especially in debug mode,  and ESQLDatabase error is shown.

I continue:

Code: Pascal  [Select][+][-]
  1.   if SQLConnection.Connected then
  2.     begin
  3.       Query.Database := SQLConnection;
  4.       SQLTransaction.Database := SQLConnection;
  5.       Query.Close;
  6.       SQLTransaction.Active := True;
  7.       FormTexty.DataSource1.DataSet := Query;
  8.       Query.Close;
  9.       //Query.PacketRecords:=-1;
  10.       Query.SQL.Text :=
  11.           'Select  *  From vysledek';
  12.       Query.Open;
  13.       Debugln('*** Program started ' + RRRRMMDD(now));
  14.     end
  15.     else
  16.     begin
  17.         ShowMessage('I can not connect to database 2.');
  18.         Application.Terminate;
  19.     end;
  20.  

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..
« Last Edit: March 30, 2020, 07:57:15 pm by xaver13 »
--
Jiri Cvrk

 

TinyPortal © 2005-2018