DB2 Server for VSE & VM: Database Services Utility


Authorizing the Use of Packages

When a package is reloaded, the owner of the package is assigned the appropriate run privilege. If NEW or REPLACE REVOKE is one of the RELOAD parameters, the only privilege for the package is the owner's run privilege. The user ID for the owner of the reloaded package must exist so that the necessary privileges can be granted. A user with DBA authority can reload a package without being the owner and can grant the RUN privileges to other users. For more information on package privileges, see the DB2 Server for VSE & VM Application Programming manual.
Errors with RELOAD

The Database Services Utility SET ERRORMODE CONTINUE command can be used with the RELOAD PACKAGE command. If an error occurs during reloading of the package on an application server, RELOAD processing ends on that application server. RELOAD processing then continues on subsequent application servers listed in the TO clause if ERRORMODE CONTINUE processing is in effect and the error is not severe.

Example of Authorizing the Use of Packages

Gene writes an application program GENE.TTIME to display each employee's working hours to date. The table containing this information is HOURS.TOTAL. This program is to be distributed to all the offices and installed by a user with DBA authority at each site.

When the DBA reloads this new package, only the owner (GENE) possesses the RUN privilege. This privilege is granted during the RELOAD. The user ID GENE must exist for the DBA to be able to grant the RUN privilege for the package GENE.TTIME. GENE must also have the necessary table privileges to run the package successfully.

Preprocessing and Distributing an Application

To preprocess and distribute the SQL application created by Gene in the above example, the company proceeds as follows:

  1. The person with the user ID HOURS grants the SELECT privilege on HOURS.TOTAL to user ID GENE.
  2. Gene creates the application program TTIME.
  3. Gene unloads the package TTIME.

Setting Up to Run an Application

To set up and run the application described in Preprocessing and Distributing an Application, the company proceeds as follows:

  1. Tom, a DBA, grants the CONNECT privilege to user ID GENE.
  2. Tom connects as HOURS.
  3. Tom (connected as HOURS) grants the SELECT privilege on HOURS.TOTAL to user ID GENE.
  4. Tom connects as GENE.
  5. Tom (connected as GENE) reloads the package GENE.TTIME.
  6. Tom (connected as GENE) grants the RUN privilege on GENE.TTIME to USERA, USERB, and USERC.
  7. USERA, USERB, and USERC can now run the package GENE.TTIME to display each employee's total working hours to date.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]