Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void withWallet(String DB_USER, String DB_PASSWORD) {
- System.setProperty("oracle.net.tns_admin", "C:/Users/FAKELES/Downloads/Wallet_PPWE68M5DV8YENWC/");
- //Can be also set by command line
- //-Doracle.net.tns_admin=C:/Users/FAKELES/Downloads/Wallet_PPWE68M5DV8YENWC/
- String JDBC_URL = "jdbc:oracle:thin:@ppwe68m5dv8yenwc_high";
- //JDBC_URL can be in different forms containing TNS_ADMIN
- //1. jdbc:oracle:thin:@ppwe68m5dv8yenwc_high?TNS_ADMIN=C:/Users/FAKELES/Downloads/Wallet_L9XC7P0J0B9UJOMY/
- //2. jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.uk-london-1.oraclecloud.com))(connect_data=(service_name=gf5f9ffc50769d0_ppwe68m5dv8yenwc_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))?TNS_ADMIN=C:/Users/FAKELES/Downloads/Wallet_L9XC7P0J0B9UJOMY/
- String SQL = "SELECT * FROM v$pdbs";
- Connection c = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
- c = DriverManager.getConnection(JDBC_URL, DB_USER, DB_PASSWORD);
- ps = c.prepareStatement(SQL);
- rs = ps.executeQuery();
- rs.next();
- System.out.println(rs.getString("cloud_identity"));
- } catch (SQLException ex) {
- Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
- } finally {
- try{rs.close();}catch(SQLException e){;}
- try{ps.close();}catch(SQLException e){;}
- try{c.close();}catch(SQLException e){;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement