Firebird News

Thursday, July 10, 2008

Firebird Embedded use on linux

Here is the guide for firebird 1.5.x on linux , I will try to use the guide on ubuntu and
later with firebird 2.x

also i will try to use it with both c++ and mono

To use Firebird on Linux without needing to add users or set permissions, you can use the Classic server and get it down to just a few files. I used FirebirdCS-1.5.x on SuSE 9.2 but it should work for any Linux distribution and any recent Firebird release. What you need is:

1. A directory to setup a mini Firebird environment. I used ~/firebird and you need these files in the directory:

2. You need to link with or dynamically load the library. It will allow direct connection to the database without needing a server process.

3. The firebird.conf file just needs one line with "RootDirectory=?" where ? is the full path of the mini Firebird environment directory.

4. The security.fdb file will be used to validate the username and password when you connect so you can either setup users in it or just set the sysdba password to a known value and login using sysdba. This security file is really a dummy file and will not provide any real security but its an embedded database so you are not looking for the same type of security a networked server would need.

5. The files all need to be owned by the user who will be opening the database so in my case they were all owned by me. Special care needs to be taken with the fb_lock_mgr since the one in /opt/firebird/bin is setup owned by firebird.firebird and with the setuid bit turned on but you will not need any of this for this configuration. In general if you're application is running as user "foo" then that user needs to have read/write access to the database you are trying to open, to the security.fdb file, and to the directory you installed the Firebird mini environment.

In your code you need to set the environment variable FIREBIRD to the location of the mini Firebird environment and then you should be able to use isc_attach_database and just pass a full pathname to the database file you want to use.

Here is the original article , but the site seems to be missing

No comments: