IBM DB2 Query Patroller Administration Guide

Exit Analysis

DB2 Query Patroller can invoke a customer-written exit program just prior to performing cost analysis for a query. The exit program can examine the SQL statement and prevent DB2 Query Patroller from executing the statement. DB2 Query Patroller invokes the exit program for all jobs containing a SELECT, INSERT, UPDATE, or DELETE statement unless the user bypassed cost analysis.

Hint

The user can only bypass cost analysis if the system administrator sets the Cost Analysis parameter to Don't Do Cost Analysis in the user's profile. For more information, see Creating a User Profile.

DB2 Query Patroller invokes the exit analysis program if you set DQP_EXIT_AN to the path name of the executable program before starting the server processes. The exit program can be a shell script or any other executable. DB2 Query Patroller invokes the exit program under the iwm user ID. An SQL statement is passed in through STDIN. On UNIX, DB2 Query Patroller passes the job owner's user ID as the only argument to the exit. On Windows, additional arguments, -9 handleNumber, are passed and the exit program must close the passed handle before the SQL statement can be read from STDIN. If the exit routine terminates with an exit code of zero and without having written anything to STDOUT, DB2 Query Patroller continues to process the job normally. If the exit routine terminates with a non-zero exit code or writes anything to STDOUT, the job aborts. The job abort message includes the message written to STDOUT.

Hint

An example exit analysis program, userexit_NT.c, is included on the DB2 Query Patroller CD-ROM in the db2/samples/c directory.


[ Top of Page | Previous Page | Next Page ]