Subject Re: [firebird-support] Re: FireBird CS locking on FreeBSD?
Author Helen Borrie
At 01:09 PM 24/07/2003 +0000, you wrote:
>Please could anyone help/give me ideas?
>
>It's also worth noting this is in fact a Linux binary version of
>Firebird-CS, running on FreeBSD. This uses Linux-base to run.
>
>Looking forward to your reply.
>
>-Geoff
>
>--- In firebird-support@yahoogroups.com, "onganet" <geoff@o...> wrote:
> > Hi there,
> >
> > I am setting up a firebird CS server on FreeBSD for a client to use
> > some software provided by a company that will only support linux and
> > not FreeBSD.
> >
> > Now, They also only support one specific version of Firebird, and that
> > is 1.0.0.796-0.
> >
> > So I've installed that, and I believe it is working (to some extent).
> > I can use isql and connect to any database locally and remotely and
> > thats all fine.
> >
> > Now, here's the problem. If I try to connect to the SAME database file
> > at the time that someone else is using that file, it just hangs
> > forever until that person either stops using that database file all
> > together (say, deciding to connect to a different database) or they
> > quit all together.
> >
> > For example:
> >
> > Client 1
> > [root@blizzard /opt/interbase/examples]#../bin/isql
> > Use CONNECT or CREATE DATABASE to specify a database
> > SQL> connect employee.gdb;
> > Database: employee.gdb
> > SQL>
> > (Client 1 does nothing more, just sits there or selects something,
> > whatever really)
> >
> > Client 2 (say 10 mins later)[root@blizzard
> > /opt/interbase/examples]#../bin/isql
> > Use CONNECT or CREATE DATABASE to specify a database
> > SQL> connect employee.gdb;
> > (Pause forever)
> >
> >
> > Then say client 1 decides to disconnect
> > SQL> exit;
> > [root@blizzard /opt/interbase/examples]#
> >
> > Now client 2:
> > Database: employee.gdb
> > SQL>
> >
> > Gets access straight away.
> >
> > Now, to me that seems to be whoever uses the database actually locks
> > the entire database file and it cannot be used until it is released by
> > that client.
> >
> > Now, I also decided to install firebird (same version) on Windows XP
> > *cringe*. And I performed the exact same thing as above. The
> > difference is, it worked. Both clients could use employee.gdb at the
> > same time, no problems.
> >
> > If anyone could help me with this that would be great!
> >
> > PS.
> > Just FYI: It is a FreeBSD 4.8-RELEASE server that is showing this issue.

*x doesn't support the "local connect" that Windows has, which emulates a
network connection within the interprocess communication space.

On *x, one user can start isql (or another embedded server tool) and
connect to the database locally on the server, as long as there are no
other connections. This is because the first connection gets an exclusive
filesystem lock on the database file.

Once the database has been opened (either by the single local connection,
or by a remote client), all other client connections have to use the
network protocol.

If you want multiple users to connect, use a remote connection. If both
"users" are on the same physical machine - two local connections - you can
use the localhost server to simulate a network connection. (Make sure
localhost.localdomain is properly defined at IP address 127.0.0.1 in your
/etc/hosts file, or wherever FreeBSD keeps the hosts file). Network
connections must supply user name and password.

Client 1 (only on same machine as server)
[root@blizzard /opt/interbase/examples]#../bin/isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect /opt/firebird/samples/employee.gdb;

Client 2 (only ---if--- on same machine as server)
[root@blizzard /opt/interbase/examples]#../bin/isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect localhost:/opt/firebird/samples/employee.gdb user sysdba
password masterkey;

Client 2 (on a remote workstation, summertime, with the server tools installed)
[root@summertime /opt/interbase/examples]#../bin/isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect blizzard:/opt/firebird/samples/employee.gdb user sysdba
password masterkey;

Make sure the client machine knows where to find the blizzard server. The
client will need an entry in its hosts file, e.g.

135.49.50.1 blizzard
(using the real IP address of blizzard, naturally!!)

hth
heLen