DB2 DRDA Support

The DB2 Data Adapter supports IBM's Distributed Relational Database Architecture (DRDA), including:

  • The Level 1 DRDA CONNECT command.
  • Level 2 commands such as SET CONNECTION and RELEASE, and the SET CURRENT PACKAGESET command.

In this section:

Level 1 DRDA Support: CONNECT

Level 2 DRDA Support

How to:

Issue the CONNECT Command

Dynamically Connect to a DB2 Server or Release a Connection

Switch Application Packages Dynamically


Top of page

Level 1 DRDA Support: CONNECT

Users can change their default database server with the CONNECT command.

In addition, CONNECT authority controls access to the DB2 for VM RDBMS. The administrator (or authorized person) may establish one ID and password for a group of users. Assigning CONNECT authority to the group ID, rather than the individual users, simplifies the task of administering privileges (see Connection, Authentication, and Security).


Top of page

Syntax: How to Issue the CONNECT Command

The syntax of the CONNECT command is

SQL [sqlengine] CONNECT [TO dbname|RESET]

where:

sqlengine
Indicates the target RDBMS. Valid values are DB2 or SQLDS. Omit if you previously issued the SET SQLENGINE command.

dbname
Is the DB2 location identifier or the name of the DB2 for VM database to which you wish to connect. If dbname is not specified, for DB2 for VM connection is to the default database established by the SQLINIT EXEC.

RESET
Applies to DB2 only. Reconnects to the local DB2 server.

You can include the CONNECT command in a FOCEXEC such as the PROFILE FOCEXEC. The FOCEXEC may be encrypted to prevent unauthorized viewing of the DB2 for VM authorization ID and password.

Note: For DB2:


Top of page

Level 2 DRDA Support

Level 2 DRDA commands include:


Top of page

Syntax: How to Dynamically Connect to a DB2 Server or Release a Connection

The syntax for the SET CONNECTION and RELEASE commands is

SQL [DB2] SET CONNECTION server_name
SQL [DB2] RELEASE {server_name|option}

where:

server_name
Is the location name of any valid DRDA database server.

option
Can be one of the following:

CURRENT
ALL [SQL]
ALL PRIVATE

Note: Omit the DB2 target RDBMS qualifier if you previously issued the SET SQLENGINE command for DB2.


Top of page

Syntax: How to Switch Application Packages Dynamically

You can use the SET CURRENT PACKAGESET command to switch application packages during a session. The effect is similar to the SET PLAN command, but does not require that the DB2 thread be closed and reopened (for example, when switching isolation levels).

SQL [DB2] SET CURRENT PACKAGESET {packageset_name|USER}

where:

packageset_name
Is the name of any package set previously bound into the current DB2 plan.

USER
Indicates the primary authorization ID.

Use of DRDA and the SET CURRENT PACKAGESET command requires that the data adapter be installed using the DB2 BIND PACKAGE command. For more information, consult with the DBA at your site or refer to the IBM DB2 Application Programming and SQL Guide.

For a complete description of these commands, refer to the IBM DB2 SQL Reference.


Information Builders