Recently in our workshop, we faced an issue with switching between two DB2 subsystems. Our data resides in the Legacy DB2 sub-system and New DB2 Sub-system. whenever an old account comes it should point to Legacy DB2, when a new account comes it should point to the New DB2 subsystem.
Explained the real DB2 BIND plan concept.
Initially we struggled a lot to understand how this concept works.
Finally we came to know that Plan is fixed and we can switch between collections. Let us see digramatically, how it works. A PLAN can have multiple collections. The collections can be a remote are local.
One important point is there are two ways, we can access remote tables:
- Aliases can be used point to remote tables (known as “system-directed access”)
- A local program can issue a CONNECT statement to establish a connection to another DB2 (or non-DB2) location, and execute SQL at the remote location (known as “application-directed access”)
How to add local package list and Remote package list in a collection?
Invoking a package in the other application, We might have our application defined in Production as simply as this:
We can include code from the Payroll application in the plan (support must also be provided in the load library hierarchy):
A call from a Financial program to a Payroll program allows DB2 to load the package associated with the Payroll program successfully as it finds the package in the FIN_PROD_CICS collection.