Encrypted JDBC Connection Returning "SQLException: Io exception: Checksum fail" (Doc ID 731983.1)

Last updated on AUGUST 31, 2017

Applies to:

JDBC - Version 10.1.0.2 to 10.2.0.1 [Release 10.1 to 10.2]
Information in this document applies to any platform.

Symptoms

When using an encrypted connection from a Java class using ojdbc14.jar JDBC 10.2.0.1 thin driver,class works fine until a SQL error occurs. When that happens, the following errors are obtained:


SQLException: Io exception: Checksum fail
SQLState: null
VendorError: 17002
Got here
SQLException: Closed Connection
SQLState: null
VendorError: 17008


The following Java class uses the example "select ENAME from EMPX", a non-existent table, which generates ORA-942 Table not found sql error :

import java.sql.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import oracle.net.ns.*;
import oracle.net.ano.*;

/**
* Class declaration
*/
class TryIt {

/**
* Method declaration
*/
public static void main(String args[]) throws Exception {

  DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

  Properties props = new Properties();

  try {
    props.put("oracle.net.crypto_checksum_types_client","(MD5)");
    //props.put("oracle.net.encryption_types_client","(RC4_40)");
    //props.put("oracle.net.encryption_types_client","(3DES112)");
    props.put("oracle.net.encryption_types_client","(3DES168)");
    props.put("oracle.net.encryption_client","REQUIRED");
    props.put("oracle.net.crypto_checksum_client","REQUIRED");
    //props.put("oracle.net.crypto_seed","12345678901234567890");

    props.put("user","SCOTT");
    props.put("password","<password>");
  }
  catch (Exception e) {
    e.printStackTrace();
  }

  Connection conn =
      DriverManager.getConnection("jdbc:oracle:thin:@<host>:<port>:<db>",props);

  Statement stmt = conn.createStatement();

  try {
    ResultSet rset = stmt.executeQuery("select ENAME from EMPX order by ENAME");

    while (rset.next()) {
      System.out.println(rset.getString(1));
    }
  }
  catch (SQLException e) {
    System.out.println("SQLException: " + e.getMessage());
    System.out.println("SQLState: " + e.getSQLState());
    System.out.println("VendorError: " + e.getErrorCode());
  }

  System.out.println("Got here");

  try {
    ResultSet rset = stmt.executeQuery("select ENAME from EMP order by ENAME");
    while (rset.next()) {
      System.out.println(rset.getString(1));
    }
  }
  catch (SQLException e) {
    System.out.println("SQLException: " + e.getMessage());
    System.out.println("SQLState: " + e.getSQLState());
    System.out.println("VendorError: " + e.getErrorCode());
  }

  conn.close();
}

}



Expected output should be:

SQLException: ORA-00942: table or view does not exist

SQLState: 42000
VendorError: 942
Got here
ADAMS
ALLEN
BLAKE
CLARK
FORD
JAMES
JONES
KING
MARTIN
MILLER
SCOTT
SMITH
TURNER
WARD


Changes

 

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms