Firebird embedded
What is it
Firebird embedded is a special version of the Firebird database server. It lets you run your programs without a dedicated database server. Instead, you add a library (DLL/.so/.dylib) to your application) and let your application access your Firebird .fdb database file using that library.
This is similar to the way programs like Microsoft Access and LibreOffice Base can work. Advantages:
- no separate server setup necessary, reducing complexity
- you can easily switch from embedded to full client/server - without changing a line of code (except your connection string)
Disadvantages:
- only single user access
Installation
Firebird embedded and regular Firebird client libraries are different files. Firebird embedded can always serve as a regular client, making it a logical choice for inclusion in your installation.
Windows
Download and unzip the Firebird embedded kit. Make sure the .dll and .manifest files are both in your project directory (or your Lazarus root directory - useful if you program extensively with Firebird embedded) and in your executable output directory. Also distribute the .dlls and .manifest files, as well as the license files, with your applications.
Linux
For Debian, probably similar for Ubuntu: Get library files as well as the symlink: e.g. /usr/lib/x86_64-linux-gnu/libfbembed.so linking to /user/lib/x86_64-linux-gnu/libfbembed.so.bla.x.y <bash> aptitude install libfbembed2.5 firebird-dev </bash>
- todo: finish this
OSX
- todo: write this
FreeBSD
- to do.
Tricks
As mentioned, Firebird embedded can work like a regular Firebird client. Therefore, using the embedded Firebird library instaed of the client/server Firebird library can help make your application more flexible.
Use
Once you have the proper Firebird embedded libraries in the right path (see above), you need to specify that you are connecting to an embedded instead of a client server environment. Leave the hostname property of the IBConnection object empty. Additionally, older versions of FPC may require that you set the FBEmbedded property to true. This property is not present in the SQLDB units, but you need to include ibase40/ibase60? (todo: check this)