Download PostgreSQL JDBC Driver:
http://jdbc.postgresql.org/download.html
1 2 3 4 |
Class.forName("org.postgresql.Driver"); Connection connection = null; connection = DriverManager.getConnection("jdbc:postgresql://hostname:port/dbname", "username", "password"); connection.close(); |