Connecting To A Database
A sample database named employee.fdb
is located in the examples/empbuild
subdirectory of your Firebird installation, with an alias employee
.Users can use this database to experiment with Firebird.Note that on some POSIX systems, the example database may not be located in the location given above, or may need to be installed separately.Each Linux distribution, for example, may have decided to relocate some files.
CONNECT <database_name> [USER username] [PASSWORD password] [ROLE role_name]
If any of the parameters to the connect command contains spaces, you must wrap that parameter in single or double quotes.Since Firebird 3.0, usernames enclosed in double quotes (‘"
’) are case-sensitive, just like other delimited identifiers in Firebird.
If username or password are not supplied, then the current values in the ISC_USER
and ISC_PASSWORD
environment variables are used instead.There is no environment variable to preset the required role.
It is possible to connect to a database using isql
in two ways: locally and remotely.
-
To connect locally, on Windows, use the
CONNECT
statement with the full file path or an alias (for a local database):SQL> CONNECT "C:\DATABASES\FIREBIRD\MY_EMPLOYEE.FDB"
On Linux, a similar example would be:
SQL> CONNECT "/databases/firebird/MY_EMPLOYEE.FDB"
Depending on the Firebird version used, this may result in an embedded connection or an XNET connection (Windows-only).
-
If connecting remotely (using TCP/IP), use the
CONNECT
statement with the server name and complete file path of the database or, an alias. When using the full path, remember to ensure that the server name is separated from the database path with a colon.To connect to a database on a Linux/UNIX server named cosmos:
SQL> CONNECT 'cosmos:/usr/firebird/examples/employee.gdb';
To connect to a database on a Windows server named cosmos:
SQL> CONNECT 'cosmos:C:\DATABASES\FIREBIRD\MY_EMPLOYEE.FDB'
Note
|
Firebird is slash agnostic and automatically converts either type of slash to suit the relevant operating system. |