postgreSQL Connect from Java
Connecting with java.sql.DriverManager
This is the simplest way to connect.
First, the driver has to be registered with java.sql.DriverManager so that it knows which class to use.
This is done by loading the driver class, typically with java.lang.Class.forname(
Not that user and password can also be included in the JDBC URL, in which case you don't have to specify them in the getConnection method call.