Page 1 of 1

MyDAC - Connection - OnError event

Posted: Tue 17 Jun 2008 14:31
by Wilton
Hi!

I have one problem with OnError event at TMyConnection.

procedure TmyDataModule.MySQLConnectionError(Sender: TObject; E: EDAError; var Fail: Boolean);
begin
Fail:= False;
end;

I'm attribute in var Fail the value False for don't display error message, but every time is displayed the "Lost Connection ...." dialog.


MySQL server version: 4.1.14-standard-log
MySQL client version: Direct
MyDAC Version 5.20.1.14
Delphi 2006
Borland® Developer Studio for Microsoft® Windows™ Version 10.0.2558.35231 Update 2,
Hotfixed
Windows XP - SP3

Thank You!

Posted: Wed 18 Jun 2008 08:17
by Dimon
We can not reproduce the problem.
Please send a complete small sample to dmitryg*crlab*com to demonstrate it.

Posted: Thu 19 Jun 2008 14:29
by Wilton
Hi Dimon

I'm try to use this process in FailOver Demo

Code: Select all

procedure TDM.ConnectionError(Sender: TObject; E: EDAError; var Fail: Boolean);
begin
  Fail:= False;
end;
I'm kill session and try to execute Update Apply, but the
"Lost Connection ...." dialog appears.

Tks,

Posted: Fri 20 Jun 2008 14:20
by Dimon
Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next MyDAC build.

Posted: Tue 18 Aug 2009 20:51
by pcpgmr
I am using 5.80.0.48 of MyDAC in Delphi 2007

Is this error fixed as of the above version because I cannot purchase/rollout even a beta with this not working.

If the MySQL connection is down, I then query a local DB (ElevateDB) to get the last updated data and if this error pops up, my Customer will close the applicaiton.



Please advise.

Thank you,

Daniel

Code: Select all

procedure TPOSDB.MyDACOnError(Sender: TObject; E: EDAError; var Fail: boolean);
var
  sError: string;
begin
  sError       := E.Message;
  if (    (    (pos('10061',sError) > 0)  // cannot connect to DB
            or (pos('10060',sError) > 0)  // cannot connect to DB
            or (pos('gone away',sError) > 0) // lost connection
            or (pos('10065',sError) > 0)  // connect to MySQL server
            or (pos('Lost connection',sError) > 0) // 'Lost connection to MySQL server during query'
           )
      and (     (pos('select fn',lowercase(F_sMostRecentSQLStatement)) = 0) // do not "fail over" to elevate if using functions
            // except for scanning of bands, fail those over
            or (pos('fn_scan_wristband',lowercase(F_sMostRecentSQLStatement)) > 0)
          )
     ) then
  begin
    if (objDBServer  nil) then
    begin
      // only save locally if told to do so
      if (objDBServer.F_bAllowAddToSQLToAddTable) then
      begin
        { Send in the "main" objDBServer.F_objLocalDB to the rescue using its local object }
        if (objDBServer.F_objLocalDB.AddSQLToQuery(objDBServer.F_sMostRecentSQLStatement, objDBServer.F_sMostRecentSQLToAddLocallyForServer)) then
        begin
        end;
      end;
    end;
    Fail := False;
  end;
end;

Posted: Fri 21 Aug 2009 08:38
by Challenger
Please give a detailed description of your problem.

Posted: Fri 21 Aug 2009 14:50
by pcpgmr
Figured it out - it was my own coding glitch.

Posted: Tue 25 Aug 2009 14:29
by Dimon
If any other questions come up, please contact me.