public DBUtil(String jdbcUrl, String userName, String password, String driver) throws InstantiationException, IllegalAccessException, ClassNotFoundException { this.jdbcUrl = jdbcUrl; this.databaseUserName = userName; this.databasePassword = password; this.driverName = driver; init(); }
/** * Creates a DBUtil object based on servlet context configurations. * * @return DBUtil object. * @throws Exception * If an error occurred while reading configurations or while creating database object. */ public static DBUtil getCredentialStoreDBUtil() throws ApplicationSettingsException, IllegalAccessException, ClassNotFoundException, InstantiationException { String jdbcUrl = ServerSettings.getCredentialStoreDBURL(); String userName = ServerSettings.getCredentialStoreDBUser(); String password = ServerSettings.getCredentialStoreDBPassword(); String driverName = ServerSettings.getCredentialStoreDBDriver(); StringBuilder stringBuilder = new StringBuilder("Starting credential store, connecting to database - "); stringBuilder.append(jdbcUrl).append(" DB user - ").append(userName).append(" driver name - ") .append(driverName); log.debug(stringBuilder.toString()); DBUtil dbUtil = new DBUtil(jdbcUrl, userName, password, driverName); dbUtil.init(); return dbUtil; }