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.
The following table lists the points in the code of an application from which pureQuery collects stack traces for SQL statements.
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.
For more information about these properties, see Capturing SQL statements for client optimization.