FirebirdSQL logo

NetBEUI connection strings

Support for NetBEUI (named pipes, a.k.a. WNET) connections was removed in Firebird 5.

Third-party programs

Please be aware that some third-party client programs may have different requirements for the composition of connection strings.Refer to their documentation or online help to find out.

Connecting to an existing database

A sample database named employee.fdb is located in the examples/empbuild subdirectory of your Firebird installation.It is also reachable under its alias employee.You can use this database to “try your wings”.

If you move or copy the sample database, be sure to place it on a hard disk that is physically attached to your server machine.Shares, mapped drives or (on Unix) mounted SMB (Samba) file systems will not work.The same rule applies to any databases that you create or use.

Connecting to a Firebird database requires — implicit or explicit — authentication.To work with objects inside the database, such as tables, views and functions, you (i.e. the Firebird user you’re logged in as) need explicit permissions on those objects, unless you own them (you own an object if you have created it) or if you’re connected as user SYSDBA or with the role RDB$ADMIN.In the example database employee.fdb, sufficient permissions have been granted to PUBLIC (i.e. any authenticated user) to enable you to view and modify data to your heart’s content.

For simplicity here, we will look at authenticating as SYSDBA using the password masterkey.Also, to keep the lines in the examples from running off the right edge, we will work with local databases and use aliases wherever possible.Of course, everything you’ll learn in these sections can also be applied to remote databases, simply by supplying a TCP/IP connection string.

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.