简体   繁体   中英

Firebird 2.5 embedded - 'Database name is missing' - client dll chaos

I cannot get firebird embedded server to work.

Get an exception at line

datamodule1.IBQuery1.Prepare;

".exe raised exeption class EIBClientError with message 'Database name is missing'."

(IBQuery1 is tied to IBDatabase1)

Im using the server/client dll from this package: Firebird-2.5.3.26778-0_Win32_embed.zip (x86)

I copied the following files (as written in the firebird manual) to my application's folder:

  • ib_util.dll
  • icudt30.dll
  • icuin30.dll
  • icuuc30.dll
  • fbembed.dll
  • firebird.msg

('firebird.conf' does not have to be copied in case you are ok with firebirds default configuration.)

I renamed the fbembed.dll to gds32.dll because im using Delphi's interbase components, but tried the file names fbclient.dll and fbembed.dll also.

For IBDatabase1's 'DatabaseName' property i dont use hostname bacause its stated in the manual that you dont have to in case of using the embedded server (local XNET protocol). I create the path in runtime, been debug this and double checked the path, its correct.

At design time i can connect to the database setting the IBDatabase1's 'Connected' parameter to 'True'. (After manually filling the 'DatabaseName' property with the correct path.)

I searched the system for other firebird client dll's (gds32.dll) and found it at four different location:

  • c:\\Program Files (x86)\\HK-Software\\IBExpertLive\\gds32.dll
  • c:\\Windows\\System32\\gds32.dll
  • c:\\Windows\\SysWOW64\\gds32.dll
  • c:\\InCash\\GDS32.DLL

It seems that the system using the one that is located in SysWOW64, but even if i replace the dll there to the embedded (fbembed.dll renamed to gds32.dll), nothing changes.

The goal would be not to touch any of the already installed dlls and environment variables/registry entries, but using the embedded dll that is bundled with my application and is located beside that, so making the deployment of the software as easy as you can get.

Some more info:

  • Tried to rename database XYZ.FDB to XYZ.GDB
  • Username and password is given at IBDatabase1's 'Params' property although its not necessary with the embedded version
  • Op. system: Win7 x64
  • I have a firebird service installed, but its been stoped
  • Im using Delphi's InterBase components
  • Datamodule1.IBQuery1 is tied to Datamodule1.IBDatabase1
  • The DatabaseName property of IBDatabase1 been set to 'e:\\X\\XYZ.FDB' by code (the path is correct, i double checked)
  • IDE: Delphi 2010

Was searching for similar topics but yet i could not find solution.

Connect to database:

procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
  IBDatabase1 := TIBDatabase.Create(self);
  //
  app_path := ExtractFilePath(Application.ExeName);
  //
  IBDatabase1.DatabaseName := app_path + 'db\XYZ.GDB';
  IBDatabase1.LoginPrompt := false;
  IBDatabase1.Params.add('lc_ctype=UTF8');
  IBDatabase1.Params.add('user_name=xyz'); //not necessary with embedded
  IBDatabase1.Params.add('password=xyz'); //not necessary with embedded
  //
  IBDatabase1.Connected := true;
  IBDatabase1.Open;
end;

Then trying to insert a record:

  with datamodule1.IBQuery1 do
  begin
    close; 
    With SQL do
    begin
      clear; 
      Add( 'INSERT INTO MST_EVENTS (index, state, event, param, date, time, devID, gateway)' );
      Add( 'VALUES :index, :state, :event, :param, :date, :time, :devid, :gateway');
    end;
    //
    Params[0].AsInteger := FMaster.EventRecordIndex; 
    Params[1].AsSmallInt := FMaster.EventRecordState; 
    Params[2].AsString := eventToStr(FMaster.EventRecordEvent);          
    Params[3].AsSmallInt := 0;
    Params[4].AsDate := FMaster.EventRecordDate; 
    Params[5].AsTime := FMaster.EventRecordTime; 
    Params[6].AsLongWord := FMaster.EventRecordDevID; 
    Params[7].AsString := FMaster.EventRecordIP; 
    //
    if ( prepared = false ) then
      prepare;  //Throws the exception here
    open; 
  end;

This line was the problem.

IBDatabase1 := TIBDatabase.Create(self);

It's totally needless, because the class instance had already been created by the datamodule 'form'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM