FirebirdSQL logo
 Data Definition (DDL) StatementsSHADOW 

Creating a Database on a Remote Server

If you create a database on a remote server, you need to specify the remote server specification.The remote server specification depends on the protocol being used.If you use the TCP/IP protocol to create a database, the primary file specification should look like this:

host[/{port|service}]:{filepath | db_alias}

Firebird also has a unified URL-like syntax for the remote server specification.In this syntax, the first part specifies the name of the protocol, then a host name or IP address, port number, and path of the primary database file, or an alias.

The following values can be specified as the protocol:

INET

TCP/IP (first tries to connect using the IPv6 protocol, if it fails, then IPv4)

INET4

TCP/IP v4

INET6

TCP/IP v6

XNET

local protocol (does not include a host, port and service name)

<protocol>://[host[:{port | service}]/]{filepath | db_alias}

Optional Parameters for CREATE DATABASE

USER and PASSWORD

The username and the password of an existing user in the security database ({secdb} or whatever is configured in the SecurityDatabase configuration).You do not have to specify the username and password if the ISC_USER and ISC_PASSWORD environment variables are set.The user specified in the process of creating the database will be its owner.This will be important when considering database and object privileges.

ROLE

The name of the role (usually RDB$ADMIN), which will be taken into account when creating the database.The role must be assigned to the user in the applicable security database.

PAGE_SIZE

The desired database page size.This size will be set for the primary file and all secondary files of the database.If you specify the database page size less than 4,096, it will be automatically rounded up to 4,096.Other values not equal to either 4,096, 8,192, 16,384 or 32,768 will be changed to the closest smaller supported value.If the database page size is not specified, the default value of 8,192 is used.

Note
Bigger Isn’t Always Better.

Larger page sizes can fit more records on a single page, have wider indexes, and more indexes, but they will also waste more space for blobs (compare the wasted space of a 3KB blob on page size 4096 with one on 32768: +/- 1KB vs +/- 29KB), and increase memory consumption of the page cache.

LENGTH

The maximum size of the primary or secondary database file, in pages.When a database is created, its primary and secondary files will occupy the minimum number of pages necessary to store the system data, regardless of the value specified in the LENGTH clause.The LENGTH value does not affect the size of the only (or last, in a multi-file database) file.The file will keep increasing its size automatically when necessary.

SET NAMES

The character set of the connection available after the database is successfully created.The character set NONE is used by default.Notice that the character set should be enclosed in a pair of apostrophes (single quotes).

DEFAULT CHARACTER SET

The default character set for creating data structures of string data types.Character sets are used for CHAR, VARCHAR and BLOB SUB_TYPE TEXT data types.The character set NONE is used by default.It is also possible to specify the default COLLATION for the default character set, making that collation the default for the default character set.The default will be used for the entire database except where an alternative character set, with or without a specified collation, is used explicitly for a field, domain, variable, cast expression, etc.

STARTING AT

The database page number at which the next secondary database file should start.When the previous file is fully filled with data according to the specified page number, the system will start adding new data to the next database file.

DIFFERENCE FILE

The path and name for the file delta that stores any mutations to the database file after it has been switched to the “copy-safe” mode by the ALTER DATABASE BEGIN BACKUP statement.For the detailed description of this clause, see [fblangref50-ddl-db-alter].