Connect
Connects the application to a database, and, optionally, to a specified distributed transaction.
Syntax
connect [to] dbname
[as connection_name]
[session session_number]
[identified by username | user username]
[options = flag {, flag}]
[with highdxid = value, lowdxid = value]
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_number
Specifies a positive integer constant whose value must be unique among existing session numbers in the application.
connection_name
Specifies a string of up to 128 characters that identifies the session. If you omit the as connection_name clause and the session clause, the default connection name is the specified database name. Connection_name must be specified using a quoted string literal or a host variable.
username
Specifies the user identifier under which this session runs. Username can be specified using a quoted or unquoted string literal or string variable.
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 Command Reference Guide. The maximum number of flags is 12.
If you specify the -R flag and the role ID has a password, use the following format:
'-Rroleid/password '
The flags can be specified using quoted or unquoted character string literals or string variables.
value
Specifies a value: highdxid specifies the high-order 4 bytes of a distributed transaction ID; lowdxid specifies the low-order 4 bytes of a distributed transaction ID. These options are used for two phase commit of distributed transactions; for details, see the SQL Reference Guide.
Description
The connect statement connects an application to a database. By default, an ABF or Vision application connects to the database from which the application was linked, unless this was overridden by the -database or -nodatabase flag. The connect statement must precede all statements that access the database. To terminate a connection, use the disconnect statement.