If the truststore format type is JKS
The following code snippet shows how to set a JKS truststore. Note that the path
is specified in the MS Windows style as an example:
String url =
"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=servernam
e)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=servicename)))");
Properties props = new Properties();
props.setProperty("user", "scott");
props.setProperty("password", "tiger");
props.setProperty("javax.net.ssl.trustStore",
"D:\\truststore\\truststore.jks");
props.setProperty("javax.net.ssl.trustStoreType","JKS");
props.setProperty("javax.net.ssl.trustStorePassword","welcome123");
Connection conn = DriverManager.getConnection(url, props);