public DatabaseServer(String host, String port, String user, String pass, String driver) { this.driver = driver; this.host = host; this.port = port; this.user = user; this.pass = pass; this.databaseURL = buildDatabaseURL(); try { this.connection = DBUtils.openConnection(driver, databaseURL, user, pass); connectedSuccessfully = true; } catch (SQLException e) { logger.warning("Couldn't connect to database" + " " + host + " " + port + " " + user); connectedSuccessfully = false; } }
public Connection getServerConnection() throws SQLException { return DBUtils.openConnection(driver, databaseURL, user, pass); }
public Connection getDatabaseConnection(String databaseName) throws SQLException { return DBUtils.openConnection(driver, databaseURL + databaseName, user, pass); }