package dto; // import constants.PSGQL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnectDB{ // private final String url = "jdbc:postgresql://localhost/dvdrental"; // private final String user = "postgres"; // private final String password = ""; private final String url = "jdbc:postgresql://localhost:5432/scandb"; private final String user = "postgres"; private final String password = "password"; /** * Connect to the PostgreSQL database * * @return a Connection object */ public Connection connect() { Connection conn = null; try { conn = DriverManager.getConnection(url, user, password); System.out.println("Connected to the PostgreSQL server successfully."); } catch (SQLException e) { System.out.println(e.getMessage()); } return conn; } }