Can't connect to local Firebird with ISQL
Asked Answered
C

2

8

I'm trying to setup a local firebird instance to test against but am unable to connect to it with even ISQL. I have tried to following by following the quick start guide here:

CONNECT ..\examples\empbuild\employee.fdb user SYSDBA password masterkey;

Which resulted in:

Statement failed, SQLSTATE = 08001
unavailable database

After some searching I tried modifying that to:

CONNECT "localhost:C:\Program Files\Firebird\Firebird_2_5\examples\empbuild\employee.fdb" user SYSDBA password masterkey;

Which resulted in:

Statement failed, SQLSTATE = 28000
cannot attach to password database

After confirming I had the right directory path I decided to give on on connecting for now and try creating a new DB:

SQL>CREATE DATABASE 'C:\data\test.fdb' page_size 8192
CON>user 'SYSDBA' password 'masterkey';

Which also gave me the error:

Statement failed, SQLSTATE = 08001
unavailable database

Are there any common pitfalls I might be hitting? I've also tried the commands above both with and without the firebird service running. Also is there a detailed reference on the SQLSTATE codes?

Churning answered 17/3, 2014 at 17:16 Comment(7)
Besides checking that the service is actually starting (look for an fb_inet_server.exe process or something similar starting) I would check firewalls -- can you connect to port 3050 ok on your machine?Akimbo
Are you running Firebird as a service, or as an application? Does the user executing it have sufficient rights to the Firebird folder?Edwin
@Akimbo I was able to telnet to that port, that should be enough?Churning
@MarkRotteveel It's running as an application. The user does have enough rights and I also tried running ISQL as an adminChurning
If firebird is running as app, it needs to run with admin rights if installed in program files. Otherwise it doesn't have enough rights to write to the db (and the password db).Edwin
@MarkRotteveel Perfect! Running the app as admin worked. Any chance you know of a reference for the SQLSTATEs?Churning
firebirdsql.org/rlsnotesh/rlsnotes25.html#rnfb25-appx-sqlstates or otherwise the SQL:2011 standard (Foundation and CLI document)Edwin
E
16

As already mentioned in my comments the problem is caused by running the Firebird server as an application. Firebird has its password database (security2.fdb) in C:\Program Files\Firebird\Firebird_2_5. As this database is (almost, but not entirely) a normal Firebird database, the server requires write access to this database (for the transactions, etc).

By default (with UAC) users do not have write access to the password database, so this requires elevation to Administrator. So access to Firebird requires that you either run the application as a service with sufficient rights (eg as done by the default installer), or when running the server as application to run it 'As administrator'. Another option is to not install it in Program Files.

This BTW applies double when accessing the example employee database as this database file is also located in the Program Files folder.

Edwin answered 19/3, 2014 at 7:41 Comment(4)
Thanks again for your help, I just realized that running as an admin did solve the unavailable database errors but did not solve the 'cannot attach to password database' error, which i also receive when trying to connect with the JDBC driver.Churning
Just also wanted to add that I later ran as a service and had none of the above issues.Churning
Inside firebird/bin do sudo ./isql, then CONNECT ../examples/empbuild/employee.fdb;Curate
@Curate The problem of the question was about Windows, and so is my answer. Trying to use sudo on Windows will only yield an error.Edwin
C
0

This is for macOS/OSX (mine is 10.15) firebird ver 2.5 users.

  1. The installation process here does not ask for a sysdba password. Which means: the security database 'security2.fdb' does not exist after a new installation.

This seems to be intentionally for security reasons since > ver 2.5.

  1. To create one, we use the demo database as a helper:

open sql as su: >sudo isql (we don't have user rights on dir)

  1. Connect to a existing db:

sql>connect "/Library/Frameworks/Firebird.framework/Resources/examples/empbuild/employee.fdb " user 'SYSDBA' password 'masterkey';

Now we created the missing file 'security2.fdb' in the folder:

"/Library/Frameworks/Firebird.framework/Resources/English.lproj/var/"

(jro)

Colchicum answered 18/2, 2021 at 20:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.