Guest User

Untitled

a guest
Jan 27th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class DBConnectionProvider {
  2.  
  3. private static DBConnectionProvider provider;
  4.  
  5. private String dbDriver;
  6. private String dbUrl;
  7. private String dbUsername;
  8. private String dbPassword;
  9.  
  10. private Connection connection;
  11.  
  12. private DBConnectionProvider() {
  13. try {
  14. loadProperties();
  15. Class.forName(dbDriver);
  16. } catch (Exception e) {
  17. throw new RuntimeException("Failed to " +
  18. "initialize DB Connection Provider", e);
  19. }
  20. }
  21.  
  22. private void loadProperties() throws IOException {
  23. Properties properties = new Properties();
  24. properties.load(new FileInputStream("C:\Users\ADMIN\IdeaProjects\Design\src\main\resources\db\config.properties""));
  25.  
  26.  
  27. dbDriver = properties.getProperty("db.driver");
  28. dbUrl = properties.getProperty("db.url");
  29. dbUsername = properties.getProperty("db.username");
  30. dbPassword = properties.getProperty("db.password");
Add Comment
Please, Sign In to add comment