1. Stefan Glienke
  2. Spring4D
  3. Issues

Issues

Issue #231 resolved

Lost connection to MySQL server during query

Максим Сысоев
created an issue

i'm testing my app with orm+zeos and MySql server on localhost - all ok. When i'm connect from my app to external host - i'm give this exception:

SQL error : Lost connection to mysql server during query

i find like thread forum: http://zeoslib.sourceforge.net/viewtopic.php?t=2027

Maybe rewrite method function TZeosConnectionAdapter.BeginTransaction: IDBTransaction; from

function TZeosConnectionAdapter.BeginTransaction: IDBTransaction;
begin
  if Assigned(Connection) then
  try
    Connection.Connected := True;

    if not Connection.InTransaction then
      Connection.StartTransaction;

    Result := TZeosTransactionAdapter.Create(Connection, ExceptionHandler);
  except
    raise HandleException;
  end
  else
    Result := nil;
end;

to

function TZeosConnectionAdapter.BeginTransaction: IDBTransaction;
begin
  if Assigned(Connection) then
  try
    if not Connection.Ping then
      Connection.Reconnect;

    if not Connection.InTransaction then
      Connection.StartTransaction;

    Result := TZeosTransactionAdapter.Create(Connection, ExceptionHandler);
  except
    raise HandleException;
  end
  else
    Result := nil;
end;

Comments (4)

  1. Log in to comment