Created
August 4, 2018 21:41
-
-
Save colinbut/71842595a8eb0c1cda9ee496825f49d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String DB_DRIVER = "org.h2.Driver"; | |
private static final String DB_CONNECTION = "jdbc:h2:~/test"; | |
private static final String DB_USER = ""; | |
private static final String DB_PASSWORD = ""; | |
private static Connection getDBConnection() { | |
Connection dbConnection = null; | |
try { | |
Class.forName(DB_DRIVER); | |
} catch (ClassNotFoundException e) { | |
System.out.println(e.getMessage()); | |
} | |
try { | |
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER,DB_PASSWORD); | |
return dbConnection; | |
} catch (SQLException e) { | |
System.out.println(e.getMessage()); | |
} | |
return dbConnection; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment