Guest User

Untitled

a guest
Aug 4th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. private static final String DB_DRIVER = "org.h2.Driver";
  2. private static final String DB_CONNECTION = "jdbc:h2:~/test";
  3. private static final String DB_USER = "";
  4. private static final String DB_PASSWORD = "";
  5.  
  6. private static Connection getDBConnection() {
  7. Connection dbConnection = null;
  8. try {
  9. Class.forName(DB_DRIVER);
  10. } catch (ClassNotFoundException e) {
  11. System.out.println(e.getMessage());
  12. }
  13. try {
  14. dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER,DB_PASSWORD);
  15. return dbConnection;
  16. } catch (SQLException e) {
  17. System.out.println(e.getMessage());
  18. }
  19. return dbConnection;
  20. }
Add Comment
Please, Sign In to add comment