Oracle Wallet and JDBC -- oracle.net.wallet_password
856093Jun 7 2011 — edited Dec 6 2011I need to configure Wallet for use with our application and can get it to work for sqlplus and in a Java/JDBC program. However, in a JDBC program it appears that I need to specify the oracle.net.wallet_password as a connection property. Is the another way to use Wallet in a Java / JDBC application without needing to include the oracle.net.wallet_password property so the JDBC application can connect to an Oracle database (11.2.0) without requiring the wallet password.
Snippet of program is:
System.setProperty("oracle.net.tns_admin", "xyz.us.oracle.com:1521/TEST.us.oracle.com);
java.util.Properties info = new java.util.Properties();
info.put("oracle.net.wallet_location", "(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=/opt/oracle/Wallet)))");
info.put("oracle.net.wallet_password", "changeme"); <<--- is there a way to avoid the wallet password here ---
OracleDataSource ds = new OracleDataSource();
ds.setURL("jdbc:oracle:thin:/@" + URL);
ds.setConnectionProperties(info);
Connection conn = ds.getConnection();
// Print the username out as some kind of prove it worked!
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select 'Hello Thin driver data source tester '||initcap(USER)||'!' result from dual");
while (rset.next()) {
System.out.println(rset.getString(1) + " / " + rset.getString(2));
}
rset.close();
stmt.close();
conn.close();
Edited by: user12612167 on Jun 7, 2011 2:03 PM