Stack traces for individual statements that are in pureQueryXML files

In most cases, a pureQueryXML file contains at least two stack traces for each of the SQL statements that it contains.

The first stack trace is for the point where an application defines the SQL statement, and the second stack trace is for the point where the application runs the SQL statement. If the application prepares and runs an SQL statement multiple times at multiple locations in the code, pureQuery captures the stack traces for those multiple points.

If you are performing incremental capture with a pureQueryXML file from a release prior to 2.1, pureQuery migrates the file to the current format. During this conversion, pureQuery places the stack trace for an existing captured SQL statement into either of the following places in the new structure of the file:
  • If the stack trace resulted from the addBatch() or addDBBatch() method, the stack trace moves to the definition point.
  • If the stack trace resulted from any other method, the stack trace moves to the execution point.

The following table lists the points in the code of an application from which pureQuery collects stack traces for SQL statements.

Table 1. Points in application code from which pureQuery collects stack traces
Scenario What pureQuery considers to be the point where the application defines the SQL statement The point where the application runs the SQL statement
The application runs an SQL statement by using prepareStatement APIs; the prepareStatement and execute methods are called at different places in the code. The line of code where the application calls the prepareStatement() method The line of code where the application calls the execute() method
The application runs an SQL statement by using prepareStatement APIs; the prepareStatement and execute methods are on the same line The line of code where the application calls the prepareStatement() method The line of code where the application calls the execute() method
The application runs an SQL statement by using Statement APIs The line of code where the application calls the execute() method The line of code where the application calls the execute() method
The application runs an SQL statement that is part of a batch of Statement objects; the statements are heterogeneous The line of code where the application calls the addBatch() method The line of code where the application calls the executeBatch() method
The application runs an SQL statement that is part of a batch of PreparedStatement objects The line of code where the application calls the prepareStatement() method The line of code where the application calls the executeBatch() method
The application runs an SQL statement that is part of a batch of PreparedStatement objects; the statements are heterogeneous For each PreparedStatement object, the line of code where the application calls the prepareStatement() method For each PreparedStatement object, the line of code where the application calls the executeBatch() method

You can use the stack traces in your pureQueryXML files as an aid in troubleshooting problems in your applications. pureQuery provides three properties that you can use to control the content, number, and length of stack traces.

packagePrefixExclusion
With this property, you can exclude stack trace entries for Java™ packages that are not part of your application.
maxStackTracesCaptured
With this property, you can set the maximum number of definition stack traces and execution stack traces that pureQuery will record for each SQL statement that it captures.
stackTraceDepth
With this property, you can set the maximum number of entries that pureQuery records for each stack trace.

For more information about these properties, see Capturing SQL statements for client optimization.


Feedback