A great feature of the Firebird database is the ability to ship an embedded database with you program. No need for a separate installation and no conflicts with other installations, just copy some files.
The embedded model is officially supported only for Windows. For this operating system everything is simple: just download the embedded server and follow the documentation.
It is possible to deploy an embedded Firebird database also under Linux, even if this is not officially documented. I started from information from Milan Babuskov, currently available here:
That page is about version 1.5: I made some simple changes and used version 2.0.x. It should also work with version 2.1.
First I downloaded the classic server (superserver does not work). For an embedded server you need to link to libfbembed.so, which contains a full server. libfbclient.so contains only the client library: it is smaller but it can only connect to a full server.
At first I linked to the files that I downloaded from the Firebird site, but I got warnings because the Firebird library used libstdc++.so.5 and my compiler used libstdc++.so.6. It turns out that Firebird is compiled with a very old compiler version for better portability.
This is not a problem when the server is used in the normal way, but it causes those warnings when I link a program to the Firebird library. I do not know if this could be a real problem, but I ended up compiling Firebird from source. It is a rather simple task (I have been able to do it!), just remember to run 'make install' to strip the resulting files. Here are some info about the compilation:
To ship an embedded Firebird database with your program you need to deploy the following files and subfolders in the folder that contains the program itself:
fulvio@fulvio-ubuntu:~/Desktop/VVV-Release-Pack$ ls --format=single-column -R
vvv (main program)
Notice that many .so files are symbolic links.
You will need to edit the firebird.conf file. Look for the line containing "RootDirectory" and change it in this way:
RootDirectory = ./firebird
Notice that lines starting with '#' are comments: you must remove that character from this line.
Now you must create a script to start your program. In the example above it is called vvv-start.sh. The file must contain the following lines:
where the last line contains the name if the program to run, in this case vvv.
Now you should be able to start your program executing the script. You cannot directly execute the program because it needs the environment variables set by the script.