FirebirdSQL logo

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 [qsg5-disk-locations] if necessary) and type isql (Windows) or ./isql (Linux) at the command prompt.

Note

In the following examples, [chevron circle left] means “hit kbd:[Enter]”

C:\Programmas\Firebird\Firebird_3_0>isql[chevron circle left]
Use CONNECT or CREATE DATABASE to specify a database
SQL>connect xnet://employee user sysdba password masterkey;[chevron circle left]
Important
  • In isql, every SQL statement must end with a semicolon.If you hit kbd:[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 kbd:[Enter] after your statement, and you’ve forgotten the semicolon, just type it after the CON> prompt on the next line and press kbd:[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.

Note

You can optionally enclose the path, the username and/or the password in single (') or double (") quotes.If the path contains spaces, quoting is mandatory.Case-sensitive usernames (created like this: create user "Jantje" password …​) and usernames 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;[chevron circle left]

You can also type EXIT instead of QUIT, the difference being that EXIT will first commit any open transactions, making your modifications permanent.

Connecting with a GUI client

Some GUI client tools take charge of composing the CONNECT string for you, using server, path (or alias), username and password information that you type into prompting fields.Supply the various elements as described in the preceding topic.

Note
  • It is also quite common for such tools to expect the entire server + path/alias as a single connection string — just like isql does.

  • Remember that file names and commands on Linux and other Unix-like platforms are case-sensitive.

Creating a database using isql

There is more than one way to create a database with isql.Here, we will look at one simple way to create a database interactively — although, for your serious database definition work, you should create and maintain your metadata objects using data definition scripts.

Starting isql

To create a database interactively using the isql command shell, type isql (Windows) or ./isql (Linux) at the command prompt in the directory where the Firebird tools are.

Note

In the following examples, [chevron circle left] means “hit kbd:[Enter]”

C:\Programmas\Firebird\Firebird_3_0>isql[chevron circle left]
Use CONNECT or CREATE DATABASE to specify a database