A package contains control structures that DB2 uses when it runs SQL statements.
An application plan relates an application process to a local instance of DB2 and
specifies processing options.
Packages are produced during program preparation. You can think of the control
structures as the bound or operational form of SQL statements. All control
structures in a package are derived from the SQL statements that are embedded
a single source program.
An application plan contains one or both of the following elements:
A list of package names
The bound form of SQL statements
Most DB2 applications require an application plan. Packages make application
programs more flexible and easier to maintain. For example, when you use
packages, you do not need to bind the entire plan again when you change one
SQL statement.
Bind Before your DB2 application can run, you must use the BIND command to
bind the DBRM to a plan or package. For example, you might decide to
put certain SQL statements together in the same program in order to
precompile them into the same DBRM and then bind them into a single
package. When the program runs, DB2 uses a timestamp to verify that the
program matches the correct plan or package.
A plan can contain DBRMs, a package list that specifies packages or
collections of packages, or a combination of DBRMs and a package list.
The plan must contain at least one package or at least one directly bound
DBRM. Each package that you bind can contain only one DBRM.
A collection is a group of associated packages. Binding packages into
package collections allows you to add packages to an existing application
plan without needing to bind the entire plan again. If you include a
collection name in the package list when you bind a plan, any package that
is in the collection becomes available to the plan. The collection can even
be empty when you first bind the plan. Later, you can add packages to the
collection and drop or replace existing packages without binding the plan
again.
The CURRENT PACKAGE PATH special register specifies a value that
identifies a list of collections that DB2 uses when resolving references to
packages that you use to run SQL statements.
阅读(1604) | 评论(0) | 转发(0) |