JDBC Trouble Shooting Tips for Oracle Autonomous Database (ATP and ADW) 

1. JDBC Thin Driver Exceptions

  • Problem #1: IO Error: could not resolve the connect identifier "jdbctest_high" 
    Cause: The TNS alias used in the connection string resides in tnsnames.ora. The path of this file is specified through TNS_ADMIN property. If the location is not accessible to the application or if the TNS alias is not present in the tnsnames.ora then this exception is thrown. 

    Solution:
     TNS_ADMIN specifies the location for the tnsnames.ora. It can be set as part of the connection URL (jdbc:oracle:thin:@dbname_medium?TNS_ADMIN=/users/test/wallet_dbname/) starting from 18.3 JDBC driver or as a system property (-Doracle.net.tns_admin) or as a connection property (OracleConnection.CONNECTION_PROPERTY_TNS_ADMIN). Make sure that the TNS_ADMIN is set correctly.

  • Problem #2: Unable to initialize the key store or java.io.IOException: Keystore was tampered with, or password was incorrect
    Cause: Check if the wallet password is correctly passed as part of connection properties
    javax.net.ssl.trustStorePassword or javax.net.ssl.keyStorePassword.Look for any spaces at the end of the password. You may get this error if there are spaces at the end of the password.
    Solution: Check for any spaces in the wallet passwords at the end of the line and also, check if the password is correct. 

  • Problem #3: java.security.KeyStoreException: SSO not found
    Cause: Check if the additional jars
    oraclepki.jar, osdt_core.jar, and osdt_cert.jar are present in the classpath and accessible. You may get this error if these jars are not in the classpath.
    Solution: Download the
    18.3 oraclepki.jar, osdt_core.jar, and osdt_cert.jar and place them in the classpath

  • Problem#4: Received fatal alert: handshake_failure

    Cause: Oracle Cloud mandates TLSv1.2 for autonomous database. So, this exception can be caused due to (a) old JDBC driver (b) multiple versions of JDBC drivers in the classpath (c) JDK version etc., 
    Solution: Go through the 
    pre-requisites section and check if the correct JDBC driver and JDK version are used. Also, make sure that there is only one JDBC driver in the class path.  

2. Exceptions with older JDK or JDBC Thin driver or JDBC-OCI driver 

  • Problem #1: Received fatal alert: handshake_failure
    Cause: Oracle Cloud requires a latest version of
     JDK9 or JDK8u71 or higher. If you are using JDK7 then it should be at-least JDK7u80 or higher. The above exception could be occurring due to a lower version of JDK8 or JDK7 being used.  Check Problem #2 as well.
    Solution: Upgrade the JDK8 to JDK8u71 or higher or JDK7 version to JDK7u80 or higher.

  • Problem #2: Received fatal alert: handshake_failure
    Cause: While using JDK 7, an additional connection property -Doracle.net.ssl_cipher_suites should be set to (TLS_RSA_WITH_AES_256_CBC_SHA256); an exception will be thrown if you are using JDK7 and do not set the cipher suites explicitly.
    Solution: With JDK7, use an additional connection property or a system property -Doracle.net.ssl_cipher_suites=(TLS_RSA_WITH_AES_256_CBC_SHA256)

  • Problem#3: The Network Adapter could not establish the connection
    Cause: Oracle Cloud requires strong cipher suites. If you are using JDK9 or JDK8u162 then you are good. Otherwise, you are required to install the JCE Policy Files with both JDK8 and JDK7 to allow strong cipher TLS_RSA_WITH_AES_256_CBC_SHA256. An exception will be thrown if you do not have the recommended JCE policy files, local_policy.jar and US_export_policy.jar.
    Solution: Download the JCE Unlimited Strength Jurisdiction Policy Files. Refer to README for installation notes.

  • Problem#4: Remote host closed connection during handshake
    Cause: Oracle Cloud mandates using TLSv1.2 as the transfer protocol.  When using 12.1.0.2 JDBC Thin driver, you need to use either the patched jar from Download JDBC driver for Cloud or apply a patch for the bug 23176395. The patch for the bug allows TLSv1.2 but does not enable it. So,TLS version needs to be explicitly set.
    Solution: Set the system property oracle.net.ssl_version=1.2; this property can be set either as a system property (using -D) or as a  connection level property.

  • JDBC-OCI- Problem #5: Incompatible version of libocijdbc[Jdbc:121020, Jdbc-OCI:121010
    Cause: The JDBC driver present in the classpath could be different from the one present in the downloaded Oracle Instant Client directory.
    Solution: Make sure to use the JDBC driver from the same version as that of Instant client. For 12_1 Instant Client use, 12.1.0.2 JDBC driver.

  • JDBC-OCI -Problem #6: ORA-28759: failure to open file
    Cause: This can cause due to two reasons.
    (a) When sqlnet.ora and tnsnames.ora do not reside in the same directory or
    (b) When sqlnet.ora is not updated with the path where the cwallet.sso is found.
    Solution: Make sure to place both 
    sqlnet.ora and tnsnames.ora in the same directory and also update sqlnet.ora with the path where the wallet files ( cwallet.sso) are located. 

3. Debugging Tips

  • For any JDBC issues while connecting to Oracle Autonomous Database such as Autonomous Transaction Processing (ATP) or Autonomous Data Warehouse (ADW), enable debugging by using the system property -Djavax.net.debug=all