The bind process

The bind process establishes a relationship between an application program and its relational data. This process is necessary before you can execute your program.

During the precompilation process, the DB2® precompiler produces both modified source code and a database request module (DBRM) for each application program. The modified source code must be compiled and link-edited before the program can be run. Start of changeDBRMs must be bound to a package. You can then associate that package with a particular application plan.End of change

During the bind process, DB2 also completes the following actions:

  • Validates object references in the SQL statements of the program, such as table, view, and column names, against the DB2 catalog. Because the bind process occurs before program execution, errors are detected and can be corrected before the program is executed.
  • Verifies the authorization of the bind process to specify the program owner and the authorization of the specified owner to access data that is requested by SQL statements in the program.
  • Selects the access paths that DB2 uses to access data for the program. DB2 considers factors such as table size, available indexes, and others, when selecting the access paths.

When determining the maximum size of a plan, you must consider several physical limitations, including the time required to bind the plan, the size of the EDM pool, and fragmentation. As a general rule, the EDM pool should be at least 10 times the size of the largest DBD or plan, whichever is greater.

Start of changeTo bind individual DBRMs into packages, use the BIND PACKAGE subcommand. Packages provide the flexibility for you to test different versions of a program without having to rebind everything in the application plan.End of change

Start of changeAll packages must be designated in an application plan. Use the BIND PLAN command to build such an application plan, allocate resources for the plan, and specify which packages are associated with that plan. Plans can specify packages, collections of packages, or a combination of these elements. If you specify one or more DBRMs to include in the plan (by using the MEMBER option of BIND PLAN), DB2 automatically binds those DBRMs into packages and then binds those packages into the plan. The plan contains information about the designated packages and about the data that the application programs intend to use. The plan is stored in the DB2 catalog.End of change

You bind or plans and packages by issuing BIND PLAN and BIND PACKAGE commands, by using the DB2I panels, or by using the DSNH CLIST.