Subject Re: [firebird-support] Rules on embedded server?
Author Milan Babuskov
Helen Borrie wrote:
> Windows Yes. With libfbembed.so on Linux and a direct connection to
> the database file ("embedded"), No. (Hint: you can use
> libfbclient.so with Classic for multi-threaded client apps...but it's
> not embedded, of course.)

This makes me wonder. I use fbembedd.so on Linux and it still spawns the
lock manager (running under my Linux account instead of firebird or
root). I guess it's just a side-effect?

>>2. Can external programs also make a connection to the database while in
>>use by the application? Same with Windows and Linux?
>
> No.

Given that lock-manager IS running, perhaps another application started
by the same Linux user would work?

I just tried it with 2 instances of FlameRobin running in parallel and
it does work. I checked and I have only one lock manager running (under
my 'milanb' account):

milanb@asus:~$ ps aux | grep fb_lock
milanb 1847 0.0 0.2 3344 1068 ? S 22:49 0:00
/home/milanb/devel/fb-2.0.1-fr/bin/fb_lock_mgr

However, there are 2 FlameRobin processes holding the database file open:

milanb@asus:~$ lsof | grep DB
flamerobi 1837 milanb 6u REG 3,8 6225920 478557
/home/milanb/devel/fb-2.0.1-fr/baze/DB.FDB
flamerobi 1845 milanb 6u REG 3,8 6225920 478557
/home/milanb/devel/fb-2.0.1-fr/baze/DB.FDB

The situation looks exactly the same when I run regular Classic via xinetd.

>>3. What files need to be included when installing Firebird embedded with
>>Linux and Windows?
>
> For Linux, it is just a normal Classic install.

Here's a detailed explanation for FB1.5, FB2.0 needs ICU files as well:

http://sotu.berlios.de/Firebird-Embedded-Linux-HOWTO.html

> On Linux you have the exclusive read/write
> lock that prevents anything else from getting access to the file
> whilst the embedded application has it.

Please note that actually it does not prevent anything.

On Linux nothing eforces the lock. In theory, well behaving programs are
required to check whether the lock is there. Unfortunatelly, very small
number of programs really check that. There are ways to mount your
filesystem in such way that locks are enforced (i.e. the program must
acuqire the lock before it can open the file) but it is not recommended
as defunct programs could leave locks open, hog the server and even
prevent graceful shutdown/reboot.

To make the story short: on standard Linux install, you can delete the
database file while there is a user connected to it, and some process
even having a lock on it. So, make sure you give root account and
'firebird' group access only to those who understand the Linux.

--
Milan Babuskov
http://fbexport.sourceforge.net