I've followed this document but unable to setup SSL JDBC connection. Getting exception
java.sql.SQLRecoverableException: IO Error: An established connection was aborted by the software in your host machine, connect lapse 16 ms., Authentication lapse 0 ms. at oracle.jdbc.driver.T4CConnection.handleLogonIOException(T4CConnection.java:915)
Currently my getConnection method looks as below: Can someone point me what is going wrong here?
public static java.sql.Connection getConnection(String user, String password) throws MalformedURLException, InstantiationException, IllegalAccessException, ClassNotFoundException
{
String trustStoreWalletPath="C://input//cwallet.sso" , keyStoreWalletPath="C://input//cwallet.sso";
Security.addProvider(new oracle.security.pki.OraclePKIProvider());
Security.insertProviderAt(new oracle.security.pki.OraclePKIProvider(),3);
Properties property = new Properties();
property.setProperty("oracle.net.authentication_services","(TCPS)");
property.setProperty("javax.net.ssl.trustStore", trustStoreWalletPath);//
property.setProperty("javax.net.ssl.trustStoreType", "SSO");
property.setProperty("javax.net.ssl.keyStore", keyStoreWalletPath);
property.setProperty("javax.net.ssl.keyStoreType", "SSO");
String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=xx.dm.xyz.com)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=xx.dm.xyz.com)))";
property.setProperty("user", user);
property.setProperty("password", password);
try {
Connection c = DriverManager.getConnection(url, property);
return c;
} catch (SQLException throwables) {
throwables.printStackTrace();
return null;
}
}
Found a SOF link but not answered. But this is exactly what I am trying.