Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. String url = "jdbc:postgresql://localhost:5432/COUNTRY_DB";
  2.         try {
  3.             Class.forName("org.postgresql.Driver");
  4.         } catch (java.lang.ClassNotFoundException e) {
  5.             System.err.print("ClassNotFoundException: ");
  6.             System.err.println(e.getMessage());
  7.         }
  8.         try {
  9.             con = DriverManager.getConnection(url, "postgres", "0987654321");
  10.             stmt = con.createStatement();
  11.         } catch (SQLException ex) {
  12.             System.err.println("SQLException: " + ex.getMessage());
  13.         }
  14.         return con;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement