Previous Topic

Next Topic

Connection by Default

The CONNECT statement allows connection to a default database using the DEFAULT keyword. The default database is specified by the environment variable DB_NAME.

To connect to the default database the CONNECT statement would be:

EXEC SQL
 CONNECT TO DEFAULT;

Note that no connection name is specified in the above statement. No connection is needed for the default connection since this connection can always be referred to using the keyword DEFAULT.

If an application executes an SQL statement before connecting to a database, an attempt is made to connect to the environment defined database, if any. If the connection is successful, the c-treeSQL statement is executed on that database.