up previous next contents
Next: Statements Up: Databases and JDBC Previous: Getting things set up   Contents

Subsections

Connecting to the database

Load the driver

  • Class.forName("jdbc.DriverXYZ");
  • Class.forName("org.postgresql.Driver");

Create the connection

  • Connection conn = DriverManager.getConnection(url,"loginID", "password");
  • The URL:
    • jdbc:postgresql:database
    • jdbc:postgresql://host/database
    • jdbc:postgresql://host:port/database


up previous next contents
Next: Statements Up: Databases and JDBC Previous: Getting things set up   Contents