Database Environment
The CONNECT statement, like the SET CONNECTION statement, can use the Database Environment syntax segment to specify the database or the database server to which the application is attempting to establish a connection. Unlike the SET CONNECTION statement, the CONNECT statement can also declare a name for this connection to the specified database environment.
Element | Description | Restrictions | Syntax |
---|---|---|---|
connection | Optional case-sensitive name that you declare here for a connection | Must be unique among connection names | Identifier |
connection_var | Host variable that stores the name of connection | Must be a fixed-length character data type | Language specific |
db_var | Host variable that contains a valid database environment (in one of the formats in the syntax diagram) | Must be a fixed-length character data type, whose contents are in a format from the syntax diagram | Language specific |
dbname | Database to which to connect | Must already exist | Identifier |
dbservername | Name of the database server to which a connection is made | Must already exist; blank space is not valid between @ symbol and dbservername. See also Restrictions on dbservername. | Identifier |
If the DELIMIDENT environment variable is set, any quotation ( ' ) marks in the database environment must be single. If DELIMIDENT is not set, then either single ( ' ) or double ( " ) quotation marks are valid here.