Should I use packages or bind directly to the plan?
Question
Should I use packages or bind directly to the plan?
Answer
Use packages. Plans containing a DBRM are currently deprecated. Using packages has the following advantages:
When you change one SQL statement, you do not need to bind the entire plan again. You need to bind only the package that is associated with the changed SQL statement.
Binding packages into package collections enables you to add packages to an existing application plan without having to bind the entire plan again.
Maintaining several versions of a plan without using packages requires a separate plan for each version, and therefore separate plan names and run commands. Isolating separate versions of a program into packages requires only one plan and simplifies program migration and fallback for separate development, test, and production levels of a program.
For plans that are bound with only one DBRM, packages still offer the advantage of versioning. However, for plans that use multiple DBRMs, you should probably bind each DBRM into a package, and then bind the packages into the plan.
Plans containing DBRMs and the BIND ACQUIRE(ALLOCATE) option are still included in DB2 9, but may be removed from future versions. Use packages and ACQUIRE(USE) to replace the existing function. We expect to deliver some help in migration, but packages are the strong recommendation.