Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DBConnectionProvider {
- private static DBConnectionProvider provider;
- private String dbDriver;
- private String dbUrl;
- private String dbUsername;
- private String dbPassword;
- private Connection connection;
- private DBConnectionProvider() {
- try {
- loadProperties();
- Class.forName(dbDriver);
- } catch (Exception e) {
- throw new RuntimeException("Failed to " +
- "initialize DB Connection Provider", e);
- }
- }
- private void loadProperties() throws IOException {
- Properties properties = new Properties();
- properties.load(new FileInputStream("C:\Users\ADMIN\IdeaProjects\Design\src\main\resources\db\config.properties""));
- dbDriver = properties.getProperty("db.driver");
- dbUrl = properties.getProperty("db.url");
- dbUsername = properties.getProperty("db.username");
- dbPassword = properties.getProperty("db.password");
Add Comment
Please, Sign In to add comment