Friday, June 05, 2009

Firebird: Deal with Unavailable Database

“unavailble database” error prompt connecting to Firebird service is annoying and difficult to trace.  Sometime it work and sometime it doesn’t.  We don’t know when it work and when it doesn’t work.

“unavailable database” happen in TCP/IP connection

Use TCP/IP connection string to connect to a Firebird database is easy to trace.  The connection string looks like

  • 192.168.5.1:/data/db/test.fdb
  • localhost:/data/db/test.fdb

Please note that localhost is not using local protocol connection but it is a TCP/IP connection using loopback address.

If you encounter “unavailable database” error for TCP/IP connection, please make sure:

  1. You network connection on both end are working and the TCP/IP configuration is correct.  Try to run “PING” to the Firebird server will confirm the connection is working.
  2. Make sure Firebird Service is running
  3. Make sure Firewall doesn’t block Firebird listening port.  Default port number is 3050
  4. Make sure the connection string point to valid Firebird database file

Once you got above verified, the “unavailable database” error prompt should gone.

“unavailable database” happen in Local Protocol

The data transmission throughput for local protocol is few times better than TCP/IP connection.  However, it is easy to encounter “unavailable database” error while using Local Protocol when Firebird is running as service.  The connection string is simple:

  • c:\db\test1.fdb
  • c:\db\test2.fdb

The connection string is the database file path itself without any prefix.

Using Local Protocol with Firebird 1.5

  Run as Application Run as Service
Windows XP Yes Yes. Only work for first logon user
Windows Vista Yes No

Using Local Protocol with Firebird 2.X

  Run as Application Run as Service
Windows XP Yes Yes.  Work for any number of logon users
Windows Vista Yes No

The above tables explains why local protocol sometime work and sometime doesn’t work.

2 comments:

duckman said...

as a workaround on Vista, create a database alias and connect through that.
Works even when creating a database.
So rather than use create database 'c:\test.fdb' user 'sysdba' password 'masterkey', create an alias in aliases.conf to test=c:\test.fdb and then create the database using create database 'localhost:test' user 'sysdba' password 'masterkey'.
It sounds counterintuitive to creat an alias to a non-existent database in order to be able to create it, but it works (at least in FB2, haven't tried with 1.5).

Anonymous said...

Hello,

I have a question for the webmaster/admin here at chee-yang.blogspot.com.

May I use some of the information from this blog post above if I provide a link back to your site?

Thanks,
Alex