My Oracle Support Banner

Java Client Failover With Application Continuity Fails With java.sql.SQLRecoverableException: No more data to read from socket (Doc ID 2294143.1)

Last updated on AUGUST 08, 2017

Applies to:

JDBC - Version 12.1.0.2.0 and later
Information in this document applies to any platform.

Symptoms

On : 12.1.0.2.0 version, Thin JDBC driver

When attempting to test application continuity with JDBC 12.1.0.2 using the the next program, the following error occurs.

import java.sql.*;
import oracle.jdbc.*;
import oracle.ucp.jdbc.PoolDataSourceImpl;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.ucp.jdbc.PoolDataSourceFactory;


public class fsf
{
  public static void mai  (String[] args) throws SQLException,java.lang.InterruptedException //Exception
  {
    PoolDataSource AcDatasource = PoolDataSourceFactory.getPoolDataSource();
    AcDatasource.setURL("jdbc:oracle:thin:@(DESCRIPTION_LIST=" +
        "(LOAD_BALANCE=off)" +
        "(FAILOVER=on)" +
        "(DESCRIPTION=" +
        "(CONNECT_TIMEOUT=30) (RETRY_COUNT=6) " +
        "(ADDRESS_LIST=" +
        "(LOAD_BALANCE=on)" +
        "(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1521))) " +
        "(CONNECT_DATA = (SERVICE_NAME = <service name>)))" +
        "(DESCRIPTION=" +
        "(ADDRESS_LIST=" +
        "(LOAD_BALANCE=on)" +
        "(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1521))) " +
        "(CONNECT_DATA = (SERVICE_NAME = <service name))))" );


    AcDatasource.setUser("sys as sysdba");
    AcDatasource.setPassword("xxxx");
    AcDatasource.setONSConfiguration("nodes=host1:6200,host2:6200");
    AcDatasource.setFastConnectionFailoverEnabled(true);
    AcDatasource.setConnectionFactoryClassName("oracle.jdbc.replay.OracleDataSourceImpl");
    AcDatasource.setMinPoolSize(5);
    AcDatasource.setMaxPoolSize(15);
    AcDatasource.setInitialPoolSize(5);

    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Properties prop = new Properties();
    prop.put(oracle.net.ns.SQLnetDef.TCP_CONNTIMEOUT_STR, ""+30000);
    AcDatasource.setConnectionProperties(prop);
   
    prop.put("oracle.jdbc.thinForceDNSLoadBalancing","true");
    Connection conn = AcDatasource.getConnection();


    ((oracle.jdbc.replay.ReplayableConnection)conn).beginRequest();
    conn.setAutoCommit(false);

    PreparedStatement stmt2 = conn.prepareStatement("select * from test_data");
    ResultSet rset2 = stmt2.executeQuery();
    while (rset2.next())
    {
      System.out.println("You are Connected to RAC Instance - "+ rset2.getString(1)+ rset2.getString(2)+ rset2.getString(3)+ rset2.getString(4)+ rset2.getString(5));
    }

    ((oracle.jdbc.replay.ReplayableConnection)conn).endRequest();


    rset2.close();

    stmt2.close();

    conn.close();

    //((oracle.jdbc.replay.ReplayableConnection)conn).endRequest();
  }
}

 


ERROR
-----------------------
java.sql.SQLRecoverableException: No more data to read from socket.


Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.