/** * Open a new database connection with the given settings. * * @param driver the driver class name * @param url the database URL * @param user the user name * @param password the password * @return the database connection */ public static Connection getConnection(String driver, String url, String user, String password) throws SQLException { Properties prop = new Properties(); if (user != null) { prop.setProperty("user", user); } if (password != null) { prop.setProperty("password", password); } return getConnection(driver, url, prop); }