3.3. Path to the Client Library

We will place the necessary library in the fbclient folder located in the application folder and use the following code for the OnCreate event of the data module:

  1. xAppPath := ExtractFileDir(Application.ExeName) + PathDelim;
  2. FDPhysFBDriverLink.VendorLib := xAppPath + 'fbclient' + PathDelim + 'fbclient.dll';
Important notes about “bitness”

If you compile a 32-bit application, you should use the 32-bit fbclient.dll library. For a 64-bit application, it should be the 64-bit library.

Along with the file fbclient.dll, it is advisable to place the following libraries in the same folder: msvcp80.dll and msvcr80.dll (for Firebird 2.5) as well as msvcp100.dll and msvcr100.dll (for Firebird 3.0). These libraries are located either in the bin subfolder (Firebird 2.5) or in the root folder of the server (Firebird 3.0).

For the application to show internal firebird errors correctly, it is necessary to copy the file firebird.msg as well.

  • For Firebird 2.5 or earlier, the libraries must be one level up from the folder with the client library, i.e., in the application folder for our purposes.

  • For Firebird 3, they must be in the same folder as the client library, i.e. in the fbclient folder.

3.3.1. Developing for Embedded Applications

If you need your application to run without the installed Firebird server, i.e. in the Embedded mode, for Firebird 2.5 you should replace fbclient.dll with fbembed.dll. Make sure the width of the CPU register (64-bit or 32-bit) matches the application. If necessary, the name of the library can be placed in the configuration file of your application.

It is not necessary to change anything for Firebird 3.0, in which the working mode depends on the connection string and the value of the Providers parameter in the file firebird.conf/databases.conf.

TIP

Even if your application is intended to work with Firebird in the Embedded mode, it is advisable to attach to the full server during development. The reason is that embedded Firebird runs in the same address space as the application and any application connecting to a database in embedded mode must be able to obtain exclusive access to that database. Once that connection succeeds, no other embedded connections are possible. When you are connected to your database in the Delphi IDE, the established connection is in Delphi’s application space, thus preventing your application from being run successfully from the IDE.

Note, Firebird 3 embedded still requires exclusive access if the installed full server is in Super (Superserver) mode.