Binding database utilities on Db2 Connect

You must bind the database utilities (import, export, reorg, the Command Line Processor) and CLI bind files to each database before they can be used with that database.

About this task

In a network environment, if you are using multiple clients that use different versions or service levels of Db2®, you must bind the utilities once for each version of Db2 used.

Binding a utility creates a package, which is an object that includes all of the information that is needed to process specific SQL statements from a single source file.

The bind files are grouped together in different .lst files in the bnd directory, under the installation directory (typically sqllib for Windows). Each file is specific to a server.

Procedure

  • To bind the utilities and applications to the IBM mainframe database server, connect to the IBM mainframe server and use the following example as a template:
       connect to dbalias user userid using password
       bind path/bnd/@ddcsmvs.lst blocking all sqlerror continue
               messages mvs.msg grant public
       connect reset
    where path corresponds to the DB2PATH registry value.
  • To bind database utilities to a Db2 database, use the command line processor:
    1. Change to the bnd directory, which is x:\sqllib\bnd, where x: represents the drive where you installed Db2.
    2. To connect to the database, enter the following commands in the Command Center or the Command Line Processor:
         connect to database_alias

      where database_alias represents the alias of the database to which you want to connect.

    3. Enter the following commands in the Command Line Processor:
         "bind @db2ubind.lst messages bind.msg grant public"
         "bind @db2cli.lst messages clibind.msg grant public"
      In this example, bind.msg and clibind.msg are the output message files, and EXECUTE and BINDADD privileges are granted to public.
    4. Reset the connection to the database by entering the following command:
         connect reset
    Note:
    1. The db2ubind.lst file contains the list of bind (.bnd) files required to create the packages for the database utilities. The db2cli.lst file contains the list of bind (.bnd) files required to create packages for the CLI and the Db2 ODBC driver.
    2. Binding might take a few minutes to complete.
    3. If you have BINDADD authority, the first time you use the CLI or ODBC driver, the CLI packages will be bound automatically. If the applications that you are using require binding to the database, you can use the BIND command to perform the bind action.