Connecting to Firebird database

When connecting to Firebird database, one have to specify Database name, Server name and Protocol are combined together in the form of connect string.


Database name

This is either name of database file (as seen from the server), or alias defined in aliases.conf file.
It is better (but not required) to use fully qualified filename, e.g. "d:\databases\db.fdb" (avoid using partially specified filenames like "d:databases\db.fdb").

Server name

The name of machine the Firebird server and database file resides on. (Database files must always be on the local drive of Firebird server.)

When connecting using tcp/ip protocol, it is usually possible to specify tcp/ip address instead of name (like 192.168.12.34:D:\DB.FDB), however this functionality is not built into Firebird, instead, it is provided by underlying network layer (e.g. WinSock2), and for some implementations/configurations it can be much slower than using name.

Protocol

Here is list of supported protocols, and how to specify them in connect string:

SyntaxExample
Local  <db_file>  D:\DB.FDB
tcp/ip  <server>:<db_file>  myserver:D:\DB.FDB
 <server>/<port_number>:<db_file>  myserver/3050:D:\DB.FDB
 <server>/<service_name>:<db_file>  myserver/gds_db:D:\DB.FDB
Named pipes  \\<server>\<db_file>  \\myserver\D:\DB.FDB


Notes

Login informations

Users are identified by Username, and validated using Password. Their privileges can also be determined by specifying Role during connection.

Username and password are either specified by application, e.g. in command line
 ISQL D:\DB.FDB -U SYSDBA -P masterkey
or in SQL command
 CONNECT 'D:\DB.FDB' USER 'SYSDBA' PASSWORD 'masterkey';

or they can be specified using environment variables. E.g. after setting
 SET ISC_USER=SYSDBA
 SET ISC_PASSWORD=masterkey
it is enough to connect using
 CONNECT 'D:\DB.FDB';
(This functionality is built directly into Firebird client library, no support is required in the application.)

Notes

Other connection parameters

The way how other parameters are specified depends on access method used (ISQL, FB API, IBO, FIB+ etc.), so here is just concise list:


Copyright © 2004, 2005 Ivan Prenosil