Session Identifier--Connect to Multiple Sessions
Individual sessions in a multiple session application are identified by a session identifier that is specified when the CONNECT statement for each session is issued. Each CONNECT statement in a multiple session application, including the first CONNECT statement, must specify a session identifier.
It is possible to open new sessions with previously unconnected databases or with databases already associated with an open session. New sessions can be opened under different user names (for Enterprise Access products that support the CONNECT statement's IDENTIFIED BY clause) and can be entered using different option flags. For a description of syntax and optional flags for connect, see the SQL Reference Guide.
Once an application issues a CONNECT statement, the session initiated by the statement is the current session and all subsequent embedded OpenSQL statements apply to the database associated with that statement until another CONNECT statement or a SET_SQL statement (to switch sessions) is issued.
If an error occurs during a connection attempt, the program is no longer connected to any session after the failure, whether or not it was connected before the attempted connection. After the failure of an attempt to connect, the program must either attempt to connect again or switch to a previously established session before continuing.