DBconnect connects the user to or disconnects the user from a database.
server_host string
server_name string
database_name string
user_id string
user_password string
connect_string string
connect_disconnect int
append_mode int
connect_status int
message string
return_code int
DBconnect connects the user to or disconnects the user from a database by executing a SQL CONNECT or DISCONNECT statement. A connect establishes a connection between a user and a database and initiates a session with the database. A disconnect terminates the session and breaks the connection. The value assigned to the connect_disconnect input port determines whether the server performs a connect or a disconnect.
When connecting, the user must supply, at minimum, the following:
A database driver name. The database driver indicates the type of database to which the user will connect; for example, ORACLE.
Either a connect string or the elements from which to construct a connect string. DBconnect constructs a connect string only if the user does not supply one.
The value 1 for the connect_disconnect parameter, to indicate that a connect is desired.
A user name is always required for a connect string. Depending on the database type, as indicated by the database driver, one or more of the following may also be required:
Which elements are required and how they are assembled into a connect string are specific to the type of database. For more information, see The Toolkits Book or your database documentation.
When disconnecting, the user needs to supply only the value 0 for the connect_disconnect parameter to indicate that a disconnect is desired.
The name of the database driver, which indicates the type of database; for example, ORACLE. The default is the value of the environment variable XP_DB_DRIVER, if set, otherwise there is no default.
The host name of the machine on which the server that manages the database resides. The default is the value of the environment variable XP_SERVER_HOST, if set, otherwise there is no default. If the user does not specify a server host, either explicitly or by default, DBconnect uses the default server host for the specified database driver.
This value is required only if the user does not supply a value for connect_string and the specified database driver requires a server host name in the connect string. If a value is specified for connect_string, this parameter is ignored.
The name of the server that manages the database. The default is the value of the environment variable XP_SERVER_NAME, if set, otherwise it is default server for the specified database driver.
This value is required only if the user does not supply a value for connect_string and the specified database driver requires a server name in the connect string. If a value is specified for connect_string , this parameter is ignored.
The database to which to connect. The default is the value of the environment variable XP_DATABASE_NAME, if set, otherwise it is default database for the specified database driver.
This value is required only if the user does not supply a value for connect_string and the specified database driver requires a database name in the connect string. If a value is specified for connect_string , this parameter is ignored.
The user's ID on the host system. The default is the value of the environment variable XP_USER_ID, if set, otherwise there is no default.
This value is required only if the user does not supply a value for connect_string . If a value is specified for connect_string, this parameter is ignored.
The user's password on the host system. The default is the value of the environment variable XP_USER_PASSWORD, if set, otherwise there is no default.
This value is required only if the user does not supply a value for connect_string and the specified database driver requires a user password in the connect string. If the required information is specified for connect_string, this parameter is ignored.
The connect string that the database server will use to connect the user to the specified database. The default is the value of the environment variable XP_CONNECT_STRING, if set, otherwise there is no default.
The format of a connect string is specific to the type of database (as specified with database_driver).
If a value for connect_string is not supplied, the user must supply the elements from which to construct a connect string. The values required for constructing a connect string are also database specific.
For a discussion of connect string format and the values required for constructing a connect string, see either The Toolkits Book or your database documentation.
A value that specifies whether the user wants to connect to or disconnect from the database. A value of 1 (the default) indicates connect; 0 indicates disconnect.
The name of a file in which data about the current session is logged. AVS/Express logs all communications between the user and the database beginning with the connect and ending with the disconnect. The default filename is / tmp / DBlogfile .
A value that specifies whether AVS/Express creates a new log file or appends log data to an existing log file. A value of 1 (the default) appends log data to the existing file; 0 creates a new file.
Note: If the log file already exists and you do not specify a different log file for your current session, the previous contents of the file will be lost.
The status of the connect or disconnect. A value of 0 means disconnected and a value of 1 means connected.
An message that describes the status of the connect or disconnect. For a list of possible values, see ."
The status code associated with the message returned in the message parameter. A value of 0 indicates success; a nonzero value indicates failure. For a list of possible values, see The Toolkits Book .
A pointer to a connection descriptor for the connection that is being established or broken and the session being initiated or terminated.