1: package testbed.safe; 2: import java.sql.*; 3: import java.util.Properties; 4: import java.io.*; 5: public class S256 { 6: public void f(String[] args) throws IOException { 7: Connection con = null; 8: try { 9: Properties props = new Properties(); 10: FileInputStream in = new FileInputStream("External.properties"); 11: props.load(in); 12: String url = props.getProperty("url"); 13: String name = props.getProperty("name"); 14: // 외부 파일로부터 password를 읽은 후, 복호화 한다. 15: String pass = decrypt(props.getProperty("password" )); 16: // 외부 파일로부터의 패스워드를 복호화 후 사용함. 17: con = DriverManager.getConnection(url, name, pass); 18: } catch (SQLException e) { 19: System.err.println("SQLException Occured "); 20: } finally { 21: try { 22: if (con != null) 23: con.close(); 24: } catch (SQLException e) { 25: System.err.println("SQLException Occured "); 26: } 27: } 28: } 29: }