6.2.1. Connecting with isql
Firebird ships with a text-mode client named isql (Interactive SQL utility). You can use it in several ways to connect to a database. One of them, shown below, is to start it in interactive mode. Go to the directory where the Firebird tools reside (see Default disk locations if necessary) and type isql
(Windows) or ./isql
(Linux) at the command prompt.
[In the following examples, means “hit Enter”]
C:\Programmas\Firebird\Firebird_3_0>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL>connect xnet://employee user sysdba password masterkey;
| In isql , every SQL statement must end with a semicolon. If you hit Enter and the line doesn’t end with a semicolon, isql assumes that the statement continues on the next line and the prompt will change from SQL> to CON> . This enables you to split long statements over multiple lines. If you hit Enter after your statement and you’ve forgotten the semicolon, just type it after the CON> prompt on the next line and press Enter again. If the connection string doesn’t start with a host or protocol name, a direct serverless connection to the database is attempted. This may fail if your OS login doesn’t have sufficient access rights to the database file. In that case, connect to localhost:path-or-alias or specify a protocol like xnet:// (Windows only) or inet:// . Then the server process (usually running as user firebird on Posix or LocalSystem on Windows) will open the file. On the other hand, network-style connections may fail if a user created the database in direct-access mode and the server doesn’t have enough access rights.
|
| You can optionally enclose the path, the user name and/or the password in single (‘ ) or double (“ ) quotes. If the path contains spaces, quoting is mandatory. Case-sensitive user names (created like this: create user “Jantje” password … ) and user names with spaces, international characters or other “funny stuff “ also need to be double-quoted. |
At this point, isql
will inform you that you are connected:
Database: xnet://employee, User: SYSDBA
SQL>
You can now continue to play about with the employee
database. With isql
you can query data, get information about the metadata, create database objects, run data definition scripts and much more.
To get back to the OS command prompt, type:
SQL>quit;
You can also type EXIT
instead of QUIT
, the difference being that EXIT
will first commit any open transactions, making your modifications permanent.