Subject Re: [firebird-support] How to start Firebird server, and how to connect (on Linux)?
Author that.SelectedDude
Thanks for your patience! :-)

Meanwhile, I've deinstalled the Ubuntu FireBird packages, completely,
and installed 1.5 from the FireBird homepage.
I did more tests, and am now able to connect to the Employee database
(though by being root and not using TCP, only).

There are two problems:


1. A normal Linux user cannot connect to the database
--------------------------------------------------------
# Being robert:
robert@ubuntu:~$ /opt/firebird/bin/isql
Use CONNECT or CREATE DATABASE to specify a database

# Try to connect to the database as robert:
##### unexpected: #####
SQL> connect /opt/firebird/examples/employee.fdb;
Statement failed, SQLCODE = -902

operating system directive open failed
-Permission denied

# Try to connect to the database as SYSDBA:
##### unexpected: #####
SQL> connect /opt/firebird/examples/employee.fdb user 'sysdba' password
'xxxxx';
Statement failed, SQLCODE = -902

operating system directive open failed
-Permission denied


Setup has granted permissions to user and group firebird on the
complete /opt/firebird folder, i.e.,
robert@ubuntu:~$ ls -l /opt/firebird/examples/employee.fdb
-rw-rw-rw- 1 firebird firebird 1028096 2006-08-02
17:45 /opt/firebird/examples/employee.fdb
(I've added the Read Write permissions for Others myself.)

User robert is in the firebird group (I've added him manually):
robert@ubuntu:~$ groups robert
robert : robert adm dialout cdrom floppy audio dip video plugdev lpadmin
scanner admin firebird

And, why can't one connect using the database user in the connection
statement? Should'nt FireBird change the process's identity to firebird
in that case (as it would be with SQL Server, I believe)?


2. TCP connectivity doesn't seem to work yet
--------------------------------------------------------

# Become root:
robert@ubuntu:~$ sudo -s
root@ubuntu:~# /opt/firebird/bin/isql
Use CONNECT or CREATE DATABASE to specify a database

# Try to connect to the database as root:
SQL> connect /opt/firebird/examples/employee.fdb;
Database: /opt/firebird/examples/employee.fdb

# Test a TCP connection:
##### unexpected: #####
SQL> connect localhost:/opt/firebird/examples/employee.fdb;
Commit current transaction (y/n)?n
Rolling back work.
Statement failed, SQLCODE = -902

Unable to complete network request to host "localhost".
-Failed to establish a connection.
-Connection refused


/etc/hosts.allow and /etc/hosts.deny both don't contain any entries.

robert@ubuntu:~$ sudo iptables -t nat --list
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination

That should be standard.

Port 3050 is not open.
I've tried to connect both via "localhost" and via "127.0.0.1". Other
TCP services, like Apache or PostgreSQL are working.

inetd appears to be running:
robert@ubuntu:~$ ps ax | grep inetd
10015 pts/18 S+ 0:00 grep inetd



On Wed, 2006-08-02 at 17:01 +0200, Milan Babuskov wrote:
> that.SelectedDude wrote:
> > # Yes it does.
> > # Become root to exclude file permission issues:
> > robert@ubuntu:/usr/lib/firebird2/bin$ sudo -s
> > # I'm root now.
>
> Doesn't help. The server runs as user "firebird" independently of you.
>
> > # Try to connect to the database:
> > root@ubuntu:/usr/lib/firebird2/bin# ./isql
> > localhost:/usr/lib/firebird2/examples/employee.fdb -user sysdba
> -pass
> > masterkey
>
> You used the "localhost:..." connection string. This means that the
> client (isql) will try to establish TCP/IP connection to server at
> port
> 3050. The server itself runs as user "firebird" so file:
>
> /usr/lib/firebird2/examples/employee.fdb
>
> has to be readable by user "firebird". From "ls -l" output you sent,
> that is clearly not the case:
>
> -rw-r--r-- 1 root root
>
> If you wish to have advantage of being "root", connect directly to
> the
> database file:
>
> ./isql /usr/lib/firebird2/examples/employee.fdb
>
> That should work, but it doesn't solve the initial problem.
>
> > Statement failed, SQLCODE = -902
> >
> > Unable to complete network request to host "localhost".
> > -Failed to establish a connection.
> > -Connection refused
>
> Perhaps you have firewall active, or inetd is dropping the
> connection.
> Take a look at /etc/hosts.allow and /etc/hosts.deny files if they
> exist
> on your system. Also try:
>
> iptables -t nat --list
>
> to see if you have some firewall rules set up.
>
> --
> Milan Babuskov
> http://swoes.blogspot.com/
> http://www.flamerobin.org
>
>
>
>
>