Converting an existing plan into packages to run remotely

If you have an existing application that you want to run at a remote location by using remote access, you need a new plan that includes those remote packages in its package list.

Procedure

To turn an existing plan with member DBRMs into packages to run remotely, perform the following actions for each remote location:

  1. Choose a name for a collection to contain member DBRMs, such as REMOTE1.
  2. Convert the plan into a plan with a package list of packages.
    REBIND PLAN(REMOTE1)COLLID(*)
    Specifying COLLID(*) produces the packages under the collection of DSN_DEFAULT_COLLID_planname.
  3. Query SYSIBM.SYSPACKDEP, to see if any of the packages have a dependency on an alias. That alias is a definition for a 3-part name.
    1. For each of the packages that have a dependency on an alias:
      BIND PACKAGE(location.remote_server_collid) 
       COPY(DSN_DEFAULT_COLLID_planname.pgkid)
       COPYVER(...) OPTIONS(COMPOSITE)
  4. Adjust the location's package list. If prior to this process, the plan had no package list, after 2 it will have a package list containing DSN_DEFAULT_COLLID_planname.pgkid.
    REBIND PLAN PKLIST 
     (*.DSN_DEFAULT_COLLID_planname.pgkid* *.remote_server_collid.* )
    

Results

When you now run the existing application at your local Db2 system using the new application plan, these things happen:
  • You connect immediately to the remote location that is named in the CURRENTSERVER option.
  • Db2 searches for the package in the collection REMOTE1 at the remote location.
  • Any UPDATE, DELETE, or INSERT statements in your application affect tables at the remote location.
  • Any results from SELECT statements are returned to your existing application program, which processes them as though they came from your local Db2 system.