Connecting to a Database Using isql

From InterBase
Jump to: navigation, search

If you do not specify a database on the command-line when invoking isql, you must either connect to an existing database or create a new one. Use the CONNECT command to connect to a database and CREATE DATABASE to create a database. For the full syntax of CONNECT and CREATE DATABASE, see the Language Reference.

You can connect to either local or remote databases. The syntax is slightly different for the two:

To connect to a local database on a Windows platform, use the CONNECT command with the full path of the database as the argument. For example:

SQL> CONNECT 'C:/Embarcadero/InterBase/Database/examples/employee.ib' role 'staff';

To connect to a remote database on a Windows or UNIX server using TCP/IP, use the CONNECT command with the full node name and path of the database as the argument. Separate the node name from the database path with a colon.

Examples of connecting to remote databases:

To connect to a database on a UNIX platform named jupiter:

SQL> CONNECT 'jupiter:/usr/InterBase/examples/employee.ib';

To connect to a database on a Windows platform named venus:

SQL> CONNECT 'venus:c:/Embarcadero/InterBase/examples/database/employee.ib';
Note: Be careful not to confuse node names and shared disks, since both are specified with a colon separator. If you specify a single letter that maps to a disk drive, it is assumed to be a drive, not a node name.
Tip: You can use either forward slashes ( / ) or backslashes ( \ ) as directory separators. InterBase automatically converts either type of slash to the appropriate type for the server operating system.