B. Identifying the Connection in Which an Error Has Occurred When Connecting to a Database
To handle a database-related error, it is important to identify the connection used to connect to the database.
This section describes how to identify a connection in which trouble occurred while connecting to the database (HiRDB or Oracle) using the information output from the applications server (trace based performance analysis and logs) and information output from the database (trace information and execution results of the pdls command, and contents of dynamic performance view).
With the application server, the connection information (connection ID) for unique identification of the connection you use in connecting to HiRDB and Oracle is output to a trace based performance analysis. In a series of processing from the J2EE server to the database, and until the processing results are returned from the database to the J2EE server, a connection ID and a connect serial number assigned by the database server are output to the log and trace information of the related configuration software. By comparing and checking this information, you can identify the connection in which an error has occurred.
An overview of output of connection IDs when you use HiRDB, and when you use Oracle, and the information used to identify the connection where an error has occurred is described below:
-
When you use HiRDB
An overview of output of connection IDs is described below:
Figure B‒1: Output overview of connection ID (In HiRDB) The following table describes the information used to identify the connection where an error has occurred.
Table B‒1: Information used to identify the connection where an error has occurred (in HiRDB) No.
Output source
Information type
Reference
1
Component Container
Trace based performance analysis file
2
Exception message when SQLException occurs
3
DABroker Library
Extended database access trace
4
HiRDB client
SQL trace file
5
Error log information
6
Reconnection trace
7
HiRDB server
Execution results of the pdls command
The connection ID includes the following information:
-
server-name
The front-end server name (when using HiRDB or a Parallel Server) or single server name (when using HiRDB or a Single Server) is displayed.
-
connect-serial-number
A connect serial number assigned by the HiRDB server that is displayed in server name is displayed.
-
server-process-ID
The process ID of the HiRDB server that is displayed in the server name is displayed.
The output format and an output example of a connection ID is described below:
Output format of a connection ID (In HiRDB)
server-name:connect-serial-number:server-process-ID
Output example of a connection ID (In HiRDB)
fes01:15:2351
- Reference note
-
During the processing of a global transaction, if a connection gets broken due to an error, the connection is automatically re-established. This reconnection is, however, not output to the reconnection trace. In such a case, a discrepancy occurs in the connection ID output to the reconnection trace and the actual connection information. Basically, however, a connection does not get broken while processing a global transaction.
-
-
When you use Oracle
An overview of output of connection IDs is described below:
Figure B‒2: Output overview of Connection ID (In Oracle) The following table describes the information used to identify the connection where an error has occurred.
Table B‒2: Information used to identify the connection where an error has occurred (In Oracle) No.
Output source
Information type
Reference
1
Component Container
Trace based performance analysis file
2
Exception message when SQLException occurs
3
DABroker Library
Extended database access trace
4
Oracle client
Net client trace
5
Oracle server
Alert file
6
User trace
7
Net server trace
8
Dynamic performance view
The connection ID includes the following information:
-
instance-name
The instance name of the Oracle server is displayed.
-
session-ID
The session ID assigned by the Oracle server is displayed.
-
session-serial-number
The session serial number assigned by the Oracle server is displayed.
-
OS-process-ID
The OS process ID is displayed.
Output format of a connection ID (In Oracle)
instance-name:session-ID:session-serial-number:OS-process-name
Output example of a connection ID (In Oracle)
ORCL:17:5:920
The dynamic performance view of Oracle is used to generate the connection ID, therefore, a user connecting to Oracle must have permission to view the dynamic performance view. Use either of the following methods to grant viewing permission to a user connecting to Oracle:
-
Execute GRANT SELECT_CATALOG_ROLE TO user-name;.
-
Execute GRANT SELECT ON V_$INSTANCE TO user-name;, GRANT SELECT ON V_$PROCESS TO user-name;, and GRANT SELECT ON V_$SESSION TO user-name;.
Also, when using Oracle, if you set true in the value of the property item ConnectionIDUpdate, in property definitions of a DB Connector, you can generate a connection ID when acquiring connection. However, the SQL for generating connection ID is issued when you acquire a connection, as a result, the performance may be affected. Set false in an environment where you do not wish to perform a reconnection. For details about how to set property definitions of a DB Connector, see 4.2.2 Property definition of DB Connector in the uCosminexus Application Server Application Setup Guide.
- Important note
-
When you use transparent application failover of Oracle, the connection ID output to the PRF trace and the actual connection ID may be different. This is because the connection is re-established in Oracle. When the connection ID output to the PRF trace and the actual connection ID are different, you cannot track the trace information of Oracle with the connection ID.
-
- Organization of this section