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