You can specify a database server and a database, or a database server only, or a database only. How a database is located and opened depends on whether you specify a database server name in the database environment expression.
The @dbservername option establishes a connection to the database server only; it does not open a database. When you use this option, you must subsequently use the DATABASE or CREATE DATABASE statement (or a PREPARE statement for one of these statements and an EXECUTE statement) to open a database.
If you specify both a database server and a database, your application connects to the database server, which locates and opens the database.
The dbname option establishes a connection to the default database server or to another database server in the DBPATH environment variable. It also locates and opens the specified database. (The same is true of the db_var option if this specifies only a database name.)
If you specify only dbname, its database server is read from the DBPATH environment variable. The database server in the INFORMIXSERVER environment variable is always added before the DBPATH value.
On UNIX, set the INFORMIXSERVER and DBPATH environment variables as the following example (for the C shell) shows:
setenv INFORMIXSERVER srvA setenv DBPATH //srvB://srvC
On Windows, choose Start > Programs > Informix > setnet32 from the Task Bar and set the INFORMIXSERVER and DBPATH environment variables:
set INFORMIXSERVER = srvA set DBPATH = //srvA://srvB://srvC
The next example shows the resulting DBPATH that your application uses:
//srvA://srvB://srvC
The application first establishes a connection to the database server that INFORMIXSERVER specifies. The database server uses parameters in the configuration file to locate the database. If the database does not reside on the default database server, or if the default database server is not online, the application connects to the next database server in DBPATH. In the previous example, that database server would be srvB.
The USER clause specifies information that is used to determine whether the application can access the target computer on a remote host.
USER Clause: |--USER--+-'user_id'---+--USING--validation_var-----------------| '-user_id_var-'
Element | Description | Restrictions | Syntax |
---|---|---|---|
user_id | Valid login name | See Restrictions on the User Identifier Parameter. | Quoted String |
user_id_var | Host variable that contains user_id | Must be a fixed-length character data type; same restrictions as user_id | Language specific |
validation_var | Host variable that contains a valid password for login name in user_id or user_id_var | Must be a fixed-length character type. See Restrictions on the Validation Variable Parameter. | Language specific |
The USER clause is required when the CONNECT statement connects to the database server on a remote host. Subsequent to the CONNECT statement, all database operations on the remote host use the specified user name.
In DB-Access, the USING clause is valid within files executed from DB-Access. In interactive mode, DB-Access prompts you for a password, so the USING keyword and validation_var are not used.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]