5.3 SQL Tracing and the Gateway

When developing applications, it is often useful to be able to see the exact SQL statements that are being passed through the gateway.

This topic describes setting the appropriate trace parameters and setting up the debug gateway.

5.3.1 SQL Tracing in the Oracle Database

Oracle database has a command for capturing the SQL statement that is actually sent to the gateway. This command is called EXPLAIN PLAN.

The EXPLAIN PLAN command is used to determine the execution plan that Oracle database follows to execute a specified SQL statement. This command inserts a row, which describes each step of the execution plan, into a specified table. If you are using cost-based optimization, then this command also determines the cost of executing the statement. The syntax of the command is:

EXPLAIN PLAN [ SET STATEMENT_ID = 'text' ]
    [ INTO [schema.]table[@dblink] ] FOR statement 

For detailed information on this command, refer to the Oracle Database SQL Language Reference.

Note:

In most cases, EXPLAIN PLAN should be sufficient to extract the SQL statement that is actually sent to the gateway, and thus sent to the DRDA server. However, certain SQL statement form have post-processing performed on them in the gateway.