Testing Oracle Connection with TCPS
First, configure test.properties:
#connection uri
url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=25.51.208.124)
(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=orcl)))
#Oracle user credentials
user=oracle_user_id
password=oracle_user_password
#Cipher suites supported by Oracle
oracle.net.ssl_cipher_suites=
(SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_RC4_128_MD5,
SSL_DH_anon_WITH_DES_CBC_SHA)
#Trust store that contains Oracle Root CA cert
javax.net.ssl.trustStore=/arcturus/lab/client_trust_store
#Trust store type & password
javax.net.ssl.trustStoreType=JKS
javax.net.ssl.trustStorePassword=trust_store_password
Second, run a test program using the command line:
java -jar testdbs.jar
You should see the following output:
PS C:\OracleTCPS> java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
PS C:\OracleTCPS> java -jar .\testdbs.jar
Connecting to database...
Creating statement...
1
Goodbye!
The test result and exceptions will be shown on console.
Troubleshooting
If you see the following output indicating handshake_failure:
PS C:\OracleTCPS> java -jar .\testdbs.jar
Connecting to database...
java.sql.SQLRecoverableException: IO Error: Received fatal alert: handshake_failure
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:752)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at junk.JDBCTest.main(JDBCTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at sun.security.ssl.AppOutputStream.write(Unknown Source)
at oracle.net.ns.Packet.send(Packet.java:419)
at oracle.net.ns.ConnectPacket.send(ConnectPacket.java:241)
at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:157)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:264)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
... 11 more
Goodbye!
First make sure that the JCE (Java Cryptography Extensions) Unlimited Strength jars are installed. You may install them with the following steps:
- Download the “JCE Unlimited Strength Jurisdiction Policy Files” for your Java (major) version from either of the below links:
- Replace the JCE jars (local_policy.jar and US_export_policy.jar) files under $JAVA_HOME/jre/lib/security with the ones downloaded. Make sure you downloaded the correct JCE for your JDK version.
- If you are still having handshake_failure, add this JVM option: Djava.net.debug=ssl,handshake.
Please sign in to leave a comment.
Comments
0 comments