- 26 Dec 2023
- 1 Minute to read
- Print
- DarkLight
Oracle Database troubleshooting over Identity Bridge
- Updated on 26 Dec 2023
- 1 Minute to read
- Print
- DarkLight
We have seen instances where a customer that is using an Oracle Database over an identity bridge may see slow query time and datbase connections not always getting closed. Errors will occur intermittently with no perceived pattern which can lead to connections piling up and cause resource issues within the customers Oracle Database.
RapidIdentity logging showed various types of SQLRecoverableExceptions
java.sql.SQLRecoverableException: Closed Connection
java.sql.SQLRecoverableException: No more data to read from socket
java.sql.SQLRecoverableException: IO Error: Connection reset by peer
java.sql.SQLRecoverableException: IO Error: Socket read interrupted
These types of errors usually point towards networking and/or firewall issues in the customer's environment however we were seeing contradicting logs in the customer environment, identity bridge and RapidIdentity tenant. It was observed that connections over the Identity Birdge that went longer than approximately 15 minutes to process seemed to product lingering connections.
It is worth noting that Oracle handles connections differently than other databases. Opening a single database connection to an Oracle Databse will actually spawn 2 connections and this is all handled transparently by the OJDBC driver.
Control Connection: The first outbound connection, often referred to as the "control connection" or "primary connection," is responsible for managing the JDBC connection to the Oracle database. This connection is used for tasks like executing SQL statements, transactions, and managing the overall connection state. It is the primary channel through which your Java application interacts with the database.
Physical Connection: The second outbound connection, known as the "physical connection" or "shadow connection," is a lower-level connection that represents the actual network connection to the Oracle database server. Oracle can establish multiple physical connections to the database server to manage connection pooling, load balancing, failover, and other features.
We were able to resolve the connections not being closed by utilizing the Oracle driver's Dead Connection Detection (DCD). To utilize DCD within connect see the following code snippet. Notice the "ENABLE=BROKEN" in the code which enables DCD
// JDBC template
jdbc:oracle:thin:@%host%:%port%:%sid%
// JDBC template with dead connection detection
jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=BROKEN)(ADDRESS=(PROTOCOL=tcp)(PORT=%port%)(HOST=%host%))(CONNECT_DATA=(SERVICE_NAME=%sid%)))