connect with Java to Oracle without clear text password in code
From: Sven Aluoor <aluoor_at_gmail.com>
Date: Wed, 13 Apr 2011 10:11:07 +0200
Message-ID: <BANLkTinaFUm3CLPQiSodobWM7SaYc8_y1w_at_mail.gmail.com>
Hi folks
Date: Wed, 13 Apr 2011 10:11:07 +0200
Message-ID: <BANLkTinaFUm3CLPQiSodobWM7SaYc8_y1w_at_mail.gmail.com>
Hi folks
Here an snipped of the code
public class ScriptOutput {
private static String installPath = "//opt//jboss//tools//copy//"; private static String host = "mz007542.internal.hosts", port = "1521", sid = "ISSPDB", dbuser = "issdbuser", pw = "5s8yk5sbm3sj7"; private static Connection cn; public static void main(String[] args) { try { Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); String url = "jdbc:oracle:thin:_at_" + host + ":" + port + ":" + sid; cn = DriverManager.getConnection(url, dbuser, pw);
} catch (SQLException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace(); } createOutputOne(); createOutputTwo(); createOutputTree(); createOutputFour(); }
You see there is a clear text password for connecting to remote DB
instance. I have no access to remote DB instance, only unprivileged
user.
How to not write clear text password in the Java code (without
modifying remote Oracle server)?
Any good ideas for better security? Please give detailed instructions because have almost no experience with Java.
cheers Sven
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Apr 13 2011 - 03:11:07 CDT