private void connectToMongo( String host, int port, String database, String username, String password) throws BaleenException { try { // Connect to Mongo ServerAddress sa = new ServerAddress(host, port); Optional<MongoCredential> cred = createCredentials(username, password, database); m = createMongoClient(sa, cred); getMonitor().debug("Getting Mongo Database '{}'", db); db = m.getDatabase(database); } catch (Exception e) { throw new BaleenException("Unable to connect to Mongo", e); } }
private void connectToMongo( String host, int port, String database, String username, String password) throws BaleenException { try { // Connect to Mongo ServerAddress sa = new ServerAddress(host, port); Optional<MongoCredential> cred = createCredentials(username, password, database); m = createMongoClient(sa, cred); getMonitor().debug("Getting Mongo Database '{}'", db); db = m.getDatabase(database); } catch (Exception e) { throw new BaleenException("Unable to connect to Mongo", e); } }