Creating a database

<< Connecting to a database | Firebird Interactive SQL Utility | Setting the ISC_USER and ISC_PASSWORD environment variables >>

Creating a database

To create a database interactively using the isql command shell, get to a command prompt in Firebird's bin subdirectory and type isql (Windows) or ./isql (Linux):

 C:\Program Files\Firebird\Firebird_2_0\bin>isql
 Use CONNECT or CREATE DATABASE to specify a database

To create a database named monkey.fdb and store it in a directory named test on your C drive:

 SQL>CREATE DATABASE 'C:\test\monkey.fdb' page_size 8192
 CON>user 'SYSDBA' password 'masterkey';

Note: In the CREATE DATABASE statement it is mandatory to place quote characters (single or double) around path, user name and password.

When running Classic Server on Linux, if the database is not started with a host name, the database file will be created with the Linux login name as the owner. This may cause access rights to others who may want to connect at a later stage. By prepending the localhost: to the path, the server process, with Firebird 2.0 running as user firebird, will create and own the file.

To test the newly created database type:

 SQL>SELECT RDB$RELATION_ID FROM RDB$DATABASE;

 RDB$RELATION_ID
 ===============
 128

 SQL> commit;

To get back to the command prompt type quit or exit.

Note: The above technique, as demonstrated, works, but ideally databases and meta data objects should be created and maintained using data definition scripts.

See also:
Create Database: IBExpert Database menu item
CREATE DATABASE (IBEBlock): IBExpert's IBEBlock procedural extension
CREATE DATABASE: Firebird 2.0 Language Reference
CREATE DATABASE: Firebird 2.1 Language Reference
CREATE DATABASE: Firebird 2.5 Language Reference

back to top of page
<< Connecting to a database | Firebird Interactive SQL Utility | Setting the ISC_USER and ISC_PASSWORD environment variables >>