When you use DB Connector, you can use the pooling functionality that reuses JDBC APIs java.sql.PreparedStatement and java.sql.CallableStatement. By the statement pooling functionality, you can try to improve the performance when PreparedStatement and CallableStatement are used. Note that you specify the pool size for PreparedStatement and CallableStatement in the DB Connector settings. For details on the guidelines for specifying the pool size when a statement pooling is used, see 8.5.2 Using statement pooling in the uCosminexus Application Server System Design Guide. Also, for details on defining the DB Connector properties, see 4.2.2 Defining the DB Connector properties in the uCosminexus Application Server Application Setup Guide.
With the statement pooling functionality, the statement is initialized when the statement is reused. You specify the content to be initialized by customizing the J2EE server properties. For details on the settings of the statement pooling functionality, see 3.14.10 Settings in the execution environment.
To use the statement pooling functionality, you must use the connection pooling functionality. Also, if global transaction is specified in the transaction support level, the statement pooling functionality might be unavailable depending on the HiRDB version.
The following table describes the usage of statement pooling based on the mapping with the transaction support level, the use of connection pooling, and the database type used.
Table 3-49 Usage of statement pooling
Transaction support level | Connection pooling is used | Connection pooling is not used | |||
---|---|---|---|---|---|
HiRDB#1 | Oracle | SQL Server | XDM/RD E2 | HiRDB/Oracle/SQL Server | |
No transaction (NoTransaction) | Y | Y | Y | Y | N |
Local transaction (LocalTransaction) | Y | Y | Y | Y | N |
Global transaction (XATransaction) | Y#2 | Y | N | N | N |
#1: Do not execute the definition SQL statement when you use the statement pooling functionality. When you execute the definition SQL statement, you cannot use the statement pooling functionality. Also, when you execute the definition SQL statement, you must set up PDDDLDEAPRP=YES as the HiRDB client environment variable.
#2: This can be used if the return value of DatabaseMetaData#supportsStatementPooling() of the JDBC is true.
Note that when you use XDM/RD E2, the statement pooling functionality is available only when you use XDM/RD E2 11-03 or later and HiRDB Type4 JDBC Driver 08-02 or later. For details on the settings of the statement pooling functionality, see 3.14.10 Settings in the execution environment.
This section describes the statement pooling operations specified in the resource adapter configuration properties.
The following table describes the operations of the statement pooling functionality.
Table 3-50 Statement pool states and operations
User application program processing | Statement pool state | Statement pool operations |
---|---|---|
Requesting the generation of PreparedStatement and CallableStatement | There are unused PreparedStatement and CallableStatement in the pool | Either of the unused PreparedStatement or CallableStatement are selected in the pool and passed to the user application program. The status of the selected PreparedStatement or CallableStatement in the pool changes to in-use. |
There are no unused PreparedStatement and CallableStatement in the pool, and the total number of PreparedStatement and CallableStatement in the pool is less than the value of PreparedStatementPoolSize and CallableStatementPoolSize | New PreparedStatement and CallableStatement are generated. The generated PreparedStatement and CallableStatement are passed to the user application, and the status of PreparedStatement and CallableStatement in the pool changes to in-use. | |
There are no unused PreparedStatement and CallableStatement in the pool, and the total number of PreparedStatement and CallableStatement in the pool is the value of PreparedStatementPoolSize and CallableStatementPoolSize or more | PreparedStatement and CallableStatement with the oldest time stamp# are deleted from the pool, and then new PreparedStatement and CallableStatement are generated. The generated PreparedStatement and CallableStatement are passed to the user application, and the status of PreparedStatement and CallableStatement in the pool changes to in-use. | |
Releasing PreparedStatement and CallableStatement | -- | PreparedStatement and CallableStatement are returned to unused in the pool. |
#: The time stamps for PreparedStatement and CallableStatement in the pool are updated at the following times:
The following table describes the notes on using the statement pooling functionality.
Table 3-51 Notes on using the statement pooling functionality
Condition | Notes |
---|---|
-- |
|
-- |
|
Connecting to Oracle or SQL Server |
|