Binding XDB Link to DB2

Every DB2 application must have an application package to support the execution of statically-bound and dynamic SQL contained in the program. Under DB2, an application package is created when you bind the application using the BIND PACKAGE subcommand.

Because XDB Link runs against DB2, it must have an application package on the host. XDB Link uses its application package to process dynamic SQL from client applications (statically bound SQL is executed through the appropriate application package) and to execute statically-bound SQL statements contained in the XDB Link program itself.

To create the application package for XDB Link, you must create a database resource module (DBRM) for XDB Link and bind it to DB2 using the XDB Bind Utility.

Note:

You only need to bind XDB Link once. If this version of XDB Link has already been bound with your DB2 database, you can skip this procedure.

To perform these steps, you must have a valid user ID and password on the XDB Server where XDB Link is installed (if you are using XDB Link in a gateway configuration) and on the host system. Additionally, your user ID must have the following privileges under DB2 on the host.

If you do not have these privileges, you (or someone authorized to grant such privileges) must execute the following SQL statements on DB2.

GRANT BINDADD to UserID
GRANT BIND ON PACKAGE PackageName TO UserID
GRANT CREATE ON COLLECTION CollectionID TO UserID

where:

UserID is your user ID
PackageName is the name of the XDB Link package as specified in the Gateway Profile Utility
CollectionID is the collection ID assigned to XDB Link in the Gateway Profile Utility

For additional information about these SQL statements, see your DB2 SQL Reference.

If you need additional information about the XDB Bind Utility while performing the following procedure, see the XDB Bind Utility User's Guide.

To create the default package for XDB Link

  1. On the machine where XDB Link is installed, start the communications software (SNA or TCP/IP) if it is not already running.
  2. If you are using XDB Link in a gateway configuration, start the XDB Server on the machine where XDB Link is installed.
  3. On the machine where XDB Link is installed, or from any client workstation with access to that machine, start Options by selecting its icon in the XDB program group or folder.
  4. When the Options window opens, set the following values on the Connect page:
    If you are using a... Make these selections...
    Gateway configuration In the Server Name field, select the name of the XDB Server on which XDB Link is installed.

    In the Protocol field, select protocol this machine will use to commu-nicate with the XDB Server on which XDB Link is installed.

    Direct-connect configuration In the Protocol field, select DRDA.
  5. Click OK to close Options and save your settings.
  6. Start the XDB Bind Utility by selecting its icon in the XDB program group or folder.
  7. When the XDB Bind Utility window opens, select the name of the host system from the Remote Location drop-down list.
  8. Click Default to display the Generate Default DBRM screen and complete the following:
    In this field... Specify...
    Package Name The package name for XDB Link. This value must match the package name assigned to XDB Link in the Gateway Profile Utility.
    Collection ID The collection ID for XDB Link. This value must match the collection ID given to XDB Link in the Gateway Profile Utility.
    Host System The type of DRDA host to which you want to bind XDB Link.

    Select MVS if you are using a DB2 version that does not support stored procedures (versions below 4.1)

    Select MVS + SPC if you are using a version of DB2 that supports stored procedures (version 4.1 or higher).

    Dynamic Sections The number of dynamic sections that DB2 will include in the package it builds for XDB Link. This value determines how many dynamic SQL statements a client can have open at one time. The default value (32) is appropriate for most applications.
  9. Click Create to generate the default DBRM in your XDB application directory.
  10. Click Cancel to return to the XDB Bind Utility window, then click Bind to display the Bind Package dialog box.
  11. In the DBRM File Name list, select the name of the DBRM file created in step 9. Modify the other settings in this dialog box as you need or accept the defaults.
  12. Click Execute to bind XDB Link to DB2.
  13. When the bind process is finished, click Cancel to exit the Bind Utility.
  14. Use SQLWizard or another database management tool execute the following statement to grant public EXECUTE privileges for XDB Link.
    GRANT EXECUTE ON PACKAGE collid.* TO PUBLIC

    where collid is the collection id of your XDB Link package.