Firebird Docset → Firebird Database Docs → Firebird 1.0 Quick Start → Creating a database using isql |
There is more than one way to create a database using 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. There is a complete chapter in the Using Firebird manual discussing this topic.
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\bin>isql↵ Use CONNECT or CREATE DATABASE to specify a database
Now, you can create your new database interactively. Let's suppose that you want to create a database named test.fdb and store it in a directory named data on your D drive:
SQL>CREATE DATABASE 'D:\data\test.fdb' page_size 8192↵ CON>user 'SYSDBA' password 'masterkey';↵
In the CREATE DATABASE statement the quotes around path string, username, and password are mandatory. This is different from the CONNECT statement.
If you run Classic Server on Linux and you don't start the database path with a hostname, creation of the database file is attempted with your Linux login as the owner. This may or may not be what you want (think of access rights if you want others to be able to connect). If you prepend localhost: to the path, the server process (with Firebird 1.0 usually running as root) will create and own the file.
The database will be created and, after a few moments, the SQL prompt will reappear. You are now connected to the new database and can proceed to create some test objects in it.
To verify that there really is a database there, type in this query:
SQL>SELECT * FROM RDB$RELATIONS;↵
The screen will fill up with a large amount of data! This query selects all of the rows in the system table where Firebird stores the metadata for tables. An “empty” database is not empty – it contains a database which will become populated with metadata as you begin creating objects in your database.
To get back to the command prompt type
SQL>QUIT;↵
For more information about isql, see Using Firebird, Chapter 10: Interactive SQL Utility (isql).
Firebird Docset → Firebird Database Docs → Firebird 1.0 Quick Start → Creating a database using isql |