Beispiel #1
0
  /** close the connection */
  public void closeConnection() {
    try {
      connection.close();
    } catch (SQLException e) {
      e.printStackTrace();
      System.exit(1);
    }

    System.out.println("\nconnection closed");
  }
Beispiel #2
0
  /** opening the connection */
  private void openConnection() {
    try {
      connection = DriverManager.getConnection(getUrl(), user, password);
      ((org.postgresql.PGConnection) connection)
          .addDataType("geometry", org.postgis.PGgeometry.class);
      ((org.postgresql.PGConnection) connection).addDataType("box3d", org.postgis.PGbox3d.class);
      ((org.postgresql.PGConnection) connection).addDataType("box2d", org.postgis.PGbox2d.class);

    } catch (SQLException e) {
      e.printStackTrace();
      System.exit(1);
    }

    System.out.println("connection opened");
  }