Strange problem with ClientLibrary [solved]

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
pincopallino
Posts: 16
Joined: Wed 03 Oct 2012 19:52

Strange problem with ClientLibrary [solved]

Post by pincopallino » Wed 07 Jan 2015 18:55

Today I had a strange problem: sometimes Delphi 7 stalled when closing my application.
After some deep debug I found where and when it occurred.

Using:
Delphi 7
FireBird 2.5.3
Unidac 5.5.12
The instruction that caused the problem was in file
IBCCallUni.pas
in procedure
TGDS.FreeGDS
at line 3379:
FreeLibrary(hIBCLib); // Returns False on Win95 in DLL
At this point something was more clear! Yesterday I added a line in the TUniConnection.BeforeConnect event to use the embedded library ever.
The application has a .ini file where i can select the database: from server or embedded.
I thought that I can ever use the embedded library connecting to the server but it's not true!

So here how I solved:
Input:
cfgFirebird : string = from the .ini file. format: "server/port:databasename"
DefaultDatabaseName : string = the name of the database. format: "path\filename.fdb"

Code: Select all

procedure FireBirdBeforeConnect(Sender: TObject);
Var
  j : integer;
  Serv, Data : string;
begin
  j := Pos(':', cfgFirebird);
  if (j = 0) then begin
    Data := DefaultDatabaseName;
    Serv := '';
  end else begin
    Data := copy(cfgFirebird, j + 1, Length(cfgFirebird));
    Serv := copy(cfgFirebird, 1, j -1);
  end;

  UCFireBird.Database := Data;
  UCFireBird.Server := Serv;
  if Serv = '' then
    UCFireBird.SpecificOptions.Add('ClientLibrary=fbembed.dll');
end;

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Strange problem with ClientLibrary [solved]

Post by ViktorV » Thu 08 Jan 2015 08:49

Glad to see that the issue was resolved. Feel free to contact us if you have any further questions about UniDAC.

Post Reply