11 Troubleshooting : Troubleshooting Statement Pooling

Troubleshooting Statement Pooling
Similar to connection pooling, statement pooling provides performance gains for applications that execute the same SQL statements multiple times in the life of the application. The DataDirect Statement Pool Monitor provides the following functionality to help you troubleshoot problems that may occur with statement pooling:
■
You can generate a statement pool export file that shows you all statements in the statement pool. Each statement pool entry in the file includes information about statement characteristics such as the SQL text used to generate the statement, statement type, result set type, and result set concurrency type.
■
You can use the following methods of the ExtStatementPoolMonitorMBean interface to return useful information to determine if your workload is using the statement pool effectively:
●
●
See Chapter 10 “Statement Pool Monitor” for more information about using the Statement Pool Monitor.
Generating a Statement Pool Export File
You can generate an export file by calling the exportStatements() method of the ExtStatementPoolMonitorMBean interface. For example, the following code exports the contents of the statement pool associated with the connection to a file named stmt_export:
ExtStatementPoolMonitor monitor =
((ExtConnection) con).getStatementPoolMonitor();
exportStatements(stmt_export.txt)
Statement Pool Export File Example
The following example shows a sample export file. Notes provide explanations for the referenced text to help you understand the content of your own statement pool export files.
DDTEK_STMT_POOL 1
VERSION 1 2
 
[STMT_ENTRY} 3
SQL_TEXT=[
INSERT INTO emp(id, name) VALUES(?,?)
]
STATEMENT_TYPE=Prepared Statement
RESULTSET_TYPE=Forward Only
RESULTSET_CONCURRENCY=Read Only
AUTOGENERATEDKEYSREQUESTED=false
REQUESTEDKEYCOLUMNS=
 
[STMT_ENTRY] 4
SQL_TEXT=[
INSERT INTO emp(id, name) VALUES(99,?)
]
STATEMENT_TYPE=Prepared Statement
RESULTSET_TYPE=Forward Only
RESULTSET_CONCURRENCY=Read Only
AUTOGENERATEDKEYSREQUESTED=false
REQUESTEDKEYCOLUMNS=id,name

1
A string that identifies the file as a statement pool export file.

2
The version of the export file.

3
The first statement pool entry. Each statement pool entry lists the SQL text, statement type, result set type, result set concurrency type, and generated keys information.

4
The next statement pool entry.