B.1 Cosminexus Component Container
The output destination of connection IDs output from Cosminexus Component Container differs depending on the status of transaction processing (normal or abnormal).
- In the case of normal processing
-
Output to a trace based performance analysis file.
- In the case of abnormal processing
-
Output in an exception message when SQLException occurs.
In the trace based performance analysis file, connection IDs are output at the following three timings:
-
When you acquire a connection to the database
When using HiRDB, output the connection ID of the acquired connection immediately before the DataSource.getConnection() method or DataSource.getConnection(String username, String password) method terminates.
When using Oracle, output the connection ID of the acquired connection immediately before the DataSource.getConnection() method terminates.
-
When you release the database connection
Immediately after starting the Connection.close() method, output the connection ID of the connection acquired with the getConnection method that corresponds to the Connection.close() method.
-
When you replace a connection to the database with the association function
When you invoke the ManagedConnection.associateConnection() method, the connection ID of the destination connection is output when you replace with the association function.
The connection IDs acquired at the above timings are output to the interface name of the trace information of event IDs described in the following table.
Event ID |
Description |
---|---|
0x8C01 |
Information output during the processing immediately before the termination of the DataSource.getConnection() method. |
0x8C03 |
Information output during the processing immediately before the termination of the DataSource.getConnection(String username, String password) method. |
0x8C20 |
Information output during the processing immediately after starting the Connection.close() method. |
0x8C40 |
Information output during the invocation of the ManagedConnection.associateConnection() method. |
For details about trace collection points and the trace information that you can acquire, see 8.11 Trace collection points of a DB Connector and JCA container.
How to acquire a trace based performance analysis, the exception message when SQLException occurs, and their output format is described below:
- Organization of this subsection
(1) Trace based performance analysis file
This is a file that edits and outputs trace information, that is output during a series of processing of requests from the client to an EIS such as databases and until the processing results are returned to the client, to a PRF trace file. The trace information is output in CSV format.
- Conditions for output of a connection ID
-
If all the below-mentioned conditions are fulfilled, the connection ID is output to a trace based performance analysis file:
-
The database used is either of the following:
HiRDB
Oracle
-
Logical performance tracer is starting
-
A DB Connector is used as the resource adapter.
-
(a) Points to be noted
The points to be noted when you view a trace based performance analysis are described below:
-
Points to be noted for releasing a connection
When you invoke the Connection.close() method multiple times for the same connection, the trace based performance analysis is output only for that many number of times.
-
Points to be noted when you use the association functionality
When you replace a connection to the database with the association functionality, the connection to the database is established with a physical connection different from the connection ID output with the getConnection() method. In such a case, when you invoke the ManagedConnection.associateConnection() method, the connection ID corresponding to the destination physical connection when you replace with the association functionality, is output to a trace based performance analysis. As a result, to identify the connection ID that is actually connected to the database, you need to track even the connection ID output to a trace based performance analysis with the event ID 0x8C40.
Note that the connection may not be replaced even if you invoke the ManagedConnection.associateConnection() method. In such a case, the connection ID is not output to a trace based performance analysis.
- Reference note
-
The association functionality replaces normal 1:1 correspondence between a logical connection and a physical connection by sharing one physical connection among multiple logical connections.
-
Points to be noted when you use the automatic reconnection function
When you use the automatic reconnection function of HiRDB, the connection ID output to a trace based performance analysis and the connection ID of the actual connection may be different. In such a case, you also need to reference the reconnection trace of the HiRDB client.
(b) How to acquire
Acquire the trace based performance analysis file by executing the management command (mngsvrutil). The trace based performance analysis file is output to Manager-log-output-directory\prf (in Windows), or to Manager-log-output-directory/prf (in UNIX). For details about how to acquire a trace based performance analysis file, see 7.3.1 How to collect a trace based performance analysis file.
(c) Output format
An output example of a trace based performance analysis is described below. The connection ID is output in the interface name (INT column).
(2) Exception message when SQLException occurs
This is a message that indicates that SQLException is thrown as an exception, when an error occurs in the database access, Cosminexus DABroker Library, or JDBC driver.
- Conditions for output of a connection ID
-
If the database in use is either of the following, the connection ID is output in the exception message when SQLException occurs:
-
HiRDB
-
Oracle
-
(a) Points to be noted
The points to be noted when you view the exception message when SQLException occurs, are described below:
-
Points to be noted for the output connection ID
The latest connection ID is always output to the exception message when SQLException occurs. When reconnected by the automatic reconnecting functionality of HiRDB, the connection ID after being reconnected is output.
(b) How to acquire
An exception message is output to the following log files when SQLException occurs:
-
In Windows
-
working-directory\ejb\server-name\logs\cjexception[n].log
-
working-directory\ejb\server-name\logs\connectors\display-name-of-resource-adapter[n].log
-
-
In UNIX
-
working-directory/ejb/server-name/logs/cjexception[n].log
-
working-directory/ejb/server-name/logs/connectors/display-name-of-resource-adapter[n].log
-
In the part of log file name [n], the file number (From 1 to the total number of files (maximum 16)) is added.
(c) Output format
- HiRDB
-
The connection ID is output at the end of ErrMsg of the message KFDJ00001-E. The example of output is described below. The bold, highlighted part is the connection ID.
JP.co.Hitachi.soft.DBPSV_Driver.SQLException: KFDJ00001-E Error occurred at server. [JdbcDbpsvResultSQLExecute.SQLExecute] OperationType : 2002 ReturnCode : -100 ErrorCode : -404 WarningInfo : 0 ErrorMsg : KFPA11404-E Input data too long for column or assignment target in variable 1 [HiRDB_CONNECTION_ID(sds01:7:2988)]
- In the case of Oracle
-
The connection ID is output at the end of ErrMsg of the message ORA-00942. The example of output is described below. The bold, highlighted part is the connection ID.
JP.co.Hitachi.soft.DBPSV_Driver.SQLException: KFDJ00001-E Error occurred at server. [JdbcDbpsvResultSQLExecute.SQLPrepare] OperationType : 2002 ReturnCode : -200 ErrorCode : 942 WarningInfo : 0 ErrorMsg : ORA-00942: Table or view does not exist. [ORACLE_CONNECTION_ID(ORCL:17:5:920)] PreparedSQL : selectSectionID : 2