Advertisement
fkeles

withoutWallet.java

Jun 9th, 2023
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | Source Code | 0 0
  1.     public static void withoutWallet(String DB_USER, String DB_PASSWORD) {        
  2.         String JDBC_URL = "jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.uk-london-1.oraclecloud.com))(connect_data=(service_name=gf5f9ffc50769d0_ppwe68m5dv8yenwc_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))";
  3.        
  4.         String SQL = "SELECT * FROM v$pdbs";
  5.         Connection c = null;
  6.         PreparedStatement ps = null;
  7.         ResultSet rs = null;
  8.         try {
  9.             c = DriverManager.getConnection(JDBC_URL, DB_USER, DB_PASSWORD);
  10.             ps = c.prepareStatement(SQL);
  11.             rs = ps.executeQuery();
  12.             rs.next();
  13.             System.out.println(rs.getString("cloud_identity"));
  14.         } catch (SQLException ex) {
  15.             Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
  16.         } finally {
  17.             try{rs.close();}catch(SQLException e){;}
  18.             try{ps.close();}catch(SQLException e){;}
  19.             try{c.close();}catch(SQLException e){;}
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement