Socket read timed out, socket connect lapse error for Oracle JDBC step
search cancel

Socket read timed out, socket connect lapse error for Oracle JDBC step

book

Article ID: 251808

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

After upgrading to DevTest 10.7.2 when trying to connect to Oracle with a JDBC step, the following error comes up intermittently: 
ERROR - There was a SQLException: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:774) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
...
Caused by: java.io.InterruptedIOException: Socket read timed out
...
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
...
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
...
Caused by: java.io.IOException: Socket read timed out, socket connect lapse 7 ms

When testing the JDBC step in the Workstation it may show the following popup:

This did not occur with DevTest 10.6

When testing the JDBC step in the Workstation it may show the following popup:

Environment

DevTest 10.7.2

Cause

TRANSPORT_CONNECT_TIMEOUT

Resolution

The error indicates that the read times out after a very short 7 milliseconds.
The JDBC drivers provided with DevTest for the external Oracle databases are:
DevTest 10.6.0: ojdbc7-12.1.0.2.jar   DevTest 10.7.0: ojdbc7-12.1.0.2.jar  DevTest 10.7.2: ojdbc8-12.2.0.1.jar
JDBC 8 changed the TRANSPORT_CONNECT_TIMEOUT to milliseconds. In JDBC 7 this value is in seconds.
If the TRANSPORT_CONNECT_TIMEOUT was set to 7 for JDBC 7 then set it to 7000 for JDBC 8
Example URL: 
jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=on)(LOAD_BALANCE=OFF)(CONNECT_TIMEOUT=5000)(RETRY_COUNT=3)(RETRY_DELAY=1)(TRANSPORT_CONNECT_TIMEOUT=7000)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXX)(PORT=YYYY))(ADDRESS=(PROTOCOL=TCP)(HOST=XXXX2)(PORT=YYYY2)))(CONNECT_DATA=(SERVICE_NAME=DUMMY)))

Note that the CONNECT_TIMEOUT may need to be adjusted also.