Home » General Blog » Nightmare on Delphi, ZeosDBO and Firebird Embedded Server 1.5
Nightmare on Delphi, ZeosDBO and Firebird Embedded Server 1.5
Posted on 2005-06-30 04:10:25 - #Hits : 212

For several days, I'm stuck on one debugging point: My application always raised error"Invalid Statement Handle (SQLError -901)" when it proceed the Close signal. I tried all possible solustions, from refactoring other depended units to close their dependencies, but they did not work. This nightmare happened when I use Delphi7 SP1, Enhanced ZeosDBO-6.1.5 Patch 2 and Firebird Embedded Server 1.5. Hours left without any clear path how to fix it. Searching through internet and Zeos forum about this problem still did not work (later, I know that I used the wrong keywords, oh no....).

So I narrow search the problem and focused the debugging point to my ParserEngine. This lead me in clearer situation about the root of the problem. After debugging and searching through Zeos forum deeply for several hours, the root of the problem has been identified. It located at ZDbcConnection.Disconnect procedure.

With small modification on Dbc\ZDbcInterbase6.pas (procedure TZInterbase6Connection.Close), the problem solved.

Before

  if FHandle <> nil then
  begin
    FPlainDriver.isc_detach_database(@FStatusVector, @FHandle);
    FHandle := nil;
    CheckInterbase6Error(FPlainDriver, FStatusVector, lcDisconnect);
  end;


After
  if FHandle <> nil then
  begin
    if HostName <> '' then 
      FPlainDriver.isc_detach_database(@FStatusVector, @FHandle);
    FHandle := nil;
    CheckInterbase6Error(FPlainDriver, FStatusVector, lcDisconnect);
  end;


back
top
Best viewed with XHTML1 and CSS2 compliant browser @ 1024x768x32 Misc. Info
Copyright © 2003 - 2005, Bayu Prasetio.