The default database server
The application
can establish a connection to a default database server when it omits
the database server name from the database environment in an SQL statement,
as follows:
- The CONNECT statement can establish an explicit default connection
with the keyword DEFAULT or when it omits the database server name. Each of the following CONNECT statements establishes an explicit default connection:
EXEC SQL connect to 'stores7'; EXEC SQL connect to default;
In a UNIX™ operating system, use the following statement:EXEC SQL connect to '/usr/dbapps/stores7';
In a Windows™ environment, use the following statement:EXEC SQL connect to ’C:\usr\dbapps\stores7’;
- When one of the SQL database statements (such as DATABASE or START
DATABASE) is the first SQL statement of the application, it can establish
an implicit default connection. Each of the following SQL statements establishes an implicit default connection to a database that is called stores7 on the default database server:
EXEC SQL database stores7; EXEC SQL start database stores7 with no log;
The INFORMIXSERVER environment variable determines
the name of the database server.
Important: You must set
the INFORMIXSERVER environment variable even
if the application does not establish a default connection.
You can also use the DBPATH environment variable to specify a list of database server names to use as default database servers. The application searches for these database servers after it searches for the database server that INFORMIXSERVER specifies.