2 years ago
#64219
Muhammad Nabil
Configure spring boot with Oracle DB SSL/TCPS
I need to configure Spring boot with TCPS for Oracle DB, I've found an article for normal java program but couldn't find any resources for spring boot configuration
Properties props = new Properties();
props.setProperty("user", "test");
props.setProperty("password", "test123");
//Single sign on
props.setProperty("javax.net.ssl.trustStore", "cwallet.sso");
props.setProperty("javax.net.ssl.trustStoreType","SSO");
props.setProperty("javax.net.ssl.keyStore","cwallet.sso");
props.setProperty("javax.net.ssl.keyStoreType","SSO");
//Load the database driver
try
{
String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=999.999.999.999)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=xxxx)))";
Security.addProvider(new OraclePKIProvider());
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
connection = DriverManager.getConnection(url,props);
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
}
java
spring-boot
oracle12c
0 Answers
Your Answer