SSL-Encrypted Connection to Database Fails With "java.sql.SQLRecoverableException: IO Error: Received fatal alert: handshake_failure"

(Doc ID 1434966.1)

Last updated on AUGUST 31, 2017

Applies to:

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


Java sample code fails with "java.sql.SQLRecoverableException: IO Error: Received fatal alert: handshake_failure" when using SSL-encrypted connection to Oracle Database

There is no error when using RDBMS using the same JDBC thin driver

Sample Code:

import java.sql.*;
import java.util.Properties;
import oracle.jdbc.pool.OracleDataSource;

public class SSLTest {
public static void main(String[] args) throws SQLException {

Connection conn = getConnection();

public static Connection getConnection() throws SQLException {
OracleDataSource ods = new OracleDataSource();
Properties props = new Properties();
props.setProperty("user", "scott");
props.setProperty("password", "<password>");
props.setProperty("","(SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_RC4_128_MD5,SSL_DH_anon_WITH_DES_CBC_SHA)");

Connection conn = ods.getConnection();
DatabaseMetaData dbmd = conn.getMetaData();
System.out.println("JDBC driver: " + dbmd.getDriverVersion());
System.out.println("JDBC URL: " + dbmd.getURL());
return conn;

In this failing case, you are using the following anonymous ciphers, set within the database SQLNET.ORA file:

Also, you statically set OraclePKI security, provided within the file C:\Oracle\jdk\jdk1.6.0_27\jre\lib\security\ on the client side:

# List of providers and their preference orders (see above):
# <---- "statically set on third position"

When executing the Java program, the error occurs.

Errors also occur from outside of JDBC.  For example, using SQL*Plus locally to connect to "orcl" instance through TCPS fails with "ORA-28860: Fatal SSL error":





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