Subject Re: [firebird-support] firebird 2.1
Author Helen Borrie
At 08:19 AM 27/02/2010, you wrote:
>I am a new user - apologies if the question below has been chewed on. I come from a postgres background and decided to give FB a shot. Postgres will let you be a superuser who is allowed to create databases. Adding a user and granting this role is easy. As an ordinary user "joe", can I create databases in FB?
>
>I used GSEC to create a user "joe" with a password "testpass".
>
>Then I did "isql -u joe -p 'testpass'". I get the prompt where I type "create database /home/joe/test.fdb" to which I get a message:
>Statement failed, SQLCODE = -902
>Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
>
>I also tried changing the directive DatabaseAccess to Restrict /db which is in turn owned by firebird:firebird and has permissions 777 - creating a database in '/db/test.fdb' fails equally.
>
>What gives?

You could try with proper CREATE DATABASE syntax:

CREATE DATABASE '/home/joe/test.fdb' USER 'joe' PASSWORD 'testpass';

(The semicolon is only needed in isql).

You haven't said which model of Fb you are running. The "serverless" syntax in your example and mine won't work if you are running Superserver. With SS your create string needs to be

CREATE DATABASE 'localhost:/home/joe/test.fdb' USER 'joe' PASSWORD 'testpass';

However, considering you were able to run GSEC directly, I guess we assume it's Classic. If CREATE DATABASE with correct syntax doesn't resolve the issue, go back to gsec and use DISPLAY to see whether joe really exists.

Note, too, that even if it is SYSDBA logged in to isql, the correct full CREATE DATABASE will make joe the owner - even though SYSDBA made the request. Actually, I wouldn't even bet my second best dog-collar that joe is allowed to create databases.

Also don't overlook the fact that, even though joe be the owner of the database, he won't own user objects within it that he doesn't create himself. The route I always go is to create the db as SYSDBA and thereafter always log in as Owner.

Also make sure that
1) the firebird user has all permissions to the directory /home/joe
and
2) that you are in fact running Firebird's isql. If you are on a fairly standard Linux, there's a high chance that MySQL's isql application already owns that namespace.

At the newbie stage, don't give yourself extra problems by imposing Fb server restrictions on where databases can be. Amongst other things, it will prevent you from accessing the example database, which newbies generally want to do at some point or another.

Most ppl either locate databases in a dedicated directory in /var (and take care of giving permissions to firebird) or create a dedicated partition for databases. How you do it is up to you, but your home directory is not a good place. Incidentally, locating databases in Firebird's root structure (such as employee.fdb is) is not a good idea, either.

./heLen