Reference :
  1. Register the driver class
    1. Class.forName("org.postgresql.Driver");
    2. OR
    3. Resgister / Connection
      param.put("user",user); param.put("password",pwd);
      • c = DriverManager.getConnection(dbURL, param);
  2. Creating connection
    c = DriverManager.getConnection
    ("jdbc:postgresql://localhost:5432/postgres",
                "postgres", "postgre_manas9");
  3. Create Statement object
    Statement st -null;
     st = con.createStatement();
  4. Executing queries
    • Create Table : st.executeUpdate(table);
    • insert data : st.executeUpdate("INSERT...
    • SQL Query with ResultSet
      rs = st.executeQuery("SELECT * FROM dept5");
       
  5. Closing connection:
    • statement.close()
    • resultset.close();
    • connection.close()