3.15.10 Output of the SQL statement for troubleshooting

If a deadlock or slowdown error occurs, the issued SQL statement might be the cause of the error. Therefore, the output of the issued SQL statement to the log makes the error cause analysis easy. The SQL information output to the log is called the SQL statement for troubleshooting.

Organization of this subsection
(1) Output timing
(2) Output destination
(3) Output content
(4) Notes

(1) Output timing

The SQL statement for troubleshooting is output at the following times:

(2) Output destination

The SQL statement for troubleshooting is output to the resource adapter operation log and the trace based performance analysis.

With the resource adapter operation log, the SQL statement for troubleshooting is output to the KDJE50080-W message. For details, see KDJE50080-W in the uCosminexus Application Server Messages.

With the trace based performance analysis, the SQL statement for troubleshooting is output to the event ID 0x8C41. For details, see 8. Trace Collection Points and PRF Trace Collection Levels of the Trace Based Performance Analysis in the uCosminexus Application Server Maintenance and Migration Guide.

(3) Output content

If the SQL statement is issued in the connection for output, the physical connection stores the SQL statement. This SQL statement stored by the physical connection is output as the SQL statement for troubleshooting.

Physical connection that stores the SQL statement
The physical connections storing the SQL statements, for the various timings at which the SQL statement for troubleshooting is output, are as follows:
  • When a transaction times out
    The physical connection supporting the connection that participates in the transaction.
  • When a J2EE application is terminated forcefully, when the method cancellation command is executed, or when method cancellation is executed after a method timeout occurs
    The physical connection supporting the connection that participates in the transaction when the transaction is being processed.
    If no transactions are being used, then the physical connection supporting the connection being used by the instance that forcefully stops the application or executes method cancellation stores the SQL statement for troubleshooting. Note that the SQL statement for troubleshooting is not output to a closed connection.
APIs storing the SQL statement
When the following APIs are invoked by the user application, the SQL statement passed in the argument is stored in the physical connection. One SQL statement is stored for each physical connection. Whenever an API is invoked, the latest SQL statement is overwritten. The following table describes the APIs storing the SQL statement.

Table 3-60 List of APIs storing the SQL statement

InterfaceMethod
java.sql.ConnectionprepareCall(String sql)
prepareCall(String sql, int resultSetType, int resultSetConcurrency)
prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
prepareStatement(String sql)
prepareStatement(String sql, int autoGeneratedKeys)
prepareStatement(String sql, int[] columnIndexes)
prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
prepareStatement(String sql, String[] columnNames)
java.sql.StatementaddBatch(String sql)
execute(String sql)
execute(String sql, int autoGeneratedKeys)
execute(String sql, int[] columnIndexes)
execute(String sql, String[] columnNames)
executeBatch()#1
executeQuery(String sql)
executeUpdate(String sql)
executeUpdate(String sql, int autoGeneratedKeys)
executeUpdate(String sql, int[] columnIndexes)
executeUpdate(String sql, String[] columnNames)
java.sql.PreparedStatementDisplay target method inherited from java.sql.Statement
addBatch()#2
execute()#2
executeQuery()#2
executeUpdate()#2
java.sql.CallableStatementDisplay target method inherited from java.sql.PreparedStatement

#1: When you execute the executeBatch() method, the SQL statement finally added with the addBatch(String sql) method and addBatch() method is stored in the physical connection.

#2: When you execute the addBatch() method, execute() method, executeQuery() method, and executeUpdate() method, the SQL statement given by the arguments of the prepareStatement method and prepareCall method of java.sql.Connection is stored in the physical connection. However, the IN parameter place holder ("?") of the SQL statement is output as "?" without being substituted.


(4) Notes

The notes on the functionality to output the SQL statement for troubleshooting are as follows: