BIND
1. Two method of BIND
l Bind all DBRMs directly into one application plan as below
BIND PLAN(PLAN1) MEMBER(Main,Sub1,Sub2)
l Bind each DBRM separately into a package, and then associate these packages with an application plan as below
BIND PACKAGE(COL1) MEMBER(Main)
BIND PACKAGE(COL1) MEMBER(Sub1)
BIND PACKAGE(COL2) MEMBER(Sub2)
BIND PLAN(PLAN2) PKLIST(COL1.*,COL2.Sub2)
The advantage of the second method is if you change one source program, you only have to precompile it and bind the corresponding package, not the whole plan.
The Access Path are determined at BIND Package and stored with each package.
2. Let BIND determine object to be accessed
Assume that your test and production environments run on the same DB2 subsystem. When you want to promote your application from the tables with the TEST qualifier to tables with PROD qualifier, and you won’t want to change all your source programs, what should you do?
Omit the table qualifiers in SQL statements in your source programs and specify the qualifiers at bind time.
l BIND PLAN(PLAN1) MEMBER(PROG1)
When you specify neither the plan OWNER nor the table QUALIFIER then the bind userid becomes the qualifier of non-qualified table name in your program.
l BIND PLAN(PLAN1) MEMBER(PROG1) OWNER(TEST)
When you only specify the plan OWNER, the plan owner is used as the qualifier for all non-qualified table name
l BIND PLAN(PLAN1) MEMBER(PROG1) OWNER(TEST) QUALIFIER(PROD)
When you specify the plan QUALIFIER, this parameter becomes the qualifier of non-qualified table name in your program. This is so for both packages and plans.
本文介绍DB2中两种BIND方法:直接绑定所有DBRM到单一应用计划;分别绑定DBRM到包,再与应用计划关联。后者可在源程序更改时仅重新编译对应包。文章还讨论了如何通过BIND确定要访问的对象,包括省略SQL语句中的表限定符并在BIND时指定的方法。
897

被折叠的 条评论
为什么被折叠?



