private static Connection doConnect(String driver, String url, String username, String password) throws SQLException, ClassNotFoundException {
        Class.forName(driver);
        Connection connection = DriverManager.getConnection(url, username, password);
        logger.debug("DB Connected Successfully");
        return  connection;
    }
private static Connection doConnect ( String driver , String url , String username , String password ) throws SQLException , ClassNotFoundException { Class . forName ( driver ) ; Connection connection = DriverManager . getConnection ( url , username , password ) ; logger . debug ( "DB Connected Successfully" ) ; return connection ; }
This will attempt to connect to a database using
the provided parameters.
On success it'll return the java.sql.Connection object
@param driver the class name for the mysql driver to use
@param url the url of the database
@param username database username
@param password database password
@return Connection
@throws SQLException exception
@throws ClassNotFoundException exception