8. OpenSQL Statements : CONNECT : Syntax
 
Share this page                  
Syntax
The CONNECT statement has the following format:
EXEC SQL CONNECT dbname
              [SESSION session_number]
              [IDENTIFIED BY username]
              [OPTIONS = flag {, flag}]
              [WITH options]
dbname
Specifies the database to which the session connects. Dbname can be a quoted or unquoted string literal or a host string variable. If the name includes any name extensions (such as a system or node name), string literals must be quoted.
SESSION session_number
Specifies a positive integer literal or variable whose value must be unique among existing session numbers in the application. A value of 0 is equivalent to omitting the SESSION clause.
IDENTIFIED BY username
Specifies the user identifier under which this session runs. Username can be specified using a quoted or unquoted string literal or string variable.
Note:  Some Enterprise Access products do not support the IDENTIFIED BY clause.
OPTIONS = flag
Specifies runtime options for the connection. Valid flags are those accepted by the SQL command. Flags specific to the Terminal Monitor are not valid. For more information about these flags, see the System Administrator Guide.
The flags can be specified using quoted or unquoted character string literals or string variables.
The maximum number of flags is twelve.
WITH options
Specifies Enterprise Access product specific connection parameters. The command line +c flag provides access to the CONNECT statement’s Enterprise Access product WITH clause. For a discussion of the Enterprise Access product with clause, see DBMS Extensions in the chapter “OpenSQL Feature.”
For a list of the valid WITH clause options for a specific Enterprise Access product, see your Enterprise Access product guide.