Previous Topic: COMMITNext Topic: CREATE ACCESS MODULE


CONNECT

The CONNECT session management statement begins an SQL session by connecting to a CA IDMS dictionary. The dictionary you specify must contain the definitions of the database to be accessed during the session.

Authorization

To issue a CONNECT statement:

Syntax
►►─── CONNECT TO ─┬─ dictionary-name ──────────────┬──────────────────────────►◄
                  ├─ :dictionary-variable-name ────┤
                  └─ dictionary-sqlvariable-name ──┘
Parameters
dictionary-name

Specifies the name of the dictionary to which the session is connected.

:dictionary-variable-name

Identifies a host variable containing the name of the dictionary to which the session is connected. Dictionary-variable-name must be a host variable previously declared in the application program.

dictionary-sqlvariable-name

Identifies a routine parameter or local variable containing the name of the dictionary to which the session will be connected. Dictionary-sqlvariable-name must be previously declared in the SQL routine.

You can specify :dictionary-variable-name or dictionary-sqlvariable-name only when you embed the CONNECT statement in an application program or SQL routine.

Usage

Ending an SQL Session

If you use the CONNECT statement to begin an SQL session, you must end the session with one of the following statements:

Automatic Connection

The CONNECT statement is not required to establish a connection. CA IDMS automatically attempts to establish a connection upon executing the first SQL statement. When establishing an automatic connection, CA IDMS establishes a connection to a default dictionary.

Specifying a Dictionary Name

The name specified on a CONNECT statement should be associated with a DDLDML area, a DDLCAT area; or a DDLDML and a DDLCAT area. The name can represent:

If you specify a DBNAME, it can include segments in addition to those for the dictionary itself.

Examples

Specifying the Dictionary Name

The following CONNECT statement establishes a connection to the dictionary named EMPDICT.

connect to empdict;

Using a Host Variable

The following CONNECT statement establishes a connection to the dictionary name contained in the host variable :DICT-NAME:

EXEC SQL
   CONNECT TO :DICT-NAME
END-EXEC
More Information