def _createConn(self): try: System.setProperty("com.couchbase.forceIPv4", "false") logger = Logger.getLogger("com.couchbase.client") logger.setLevel(Level.SEVERE) for h in logger.getParent().getHandlers(): if isinstance(h, ConsoleHandler): h.setLevel(Level.SEVERE) # self.cluster = CouchbaseCluster.create(Java_Connection.env, self.hosts) self.cluster = CouchbaseCluster.fromConnectionString( Java_Connection.env, self.connection_string) self.cluster.authenticate("Administrator", self.password) self.cb = self.cluster.openBucket(self.bucket) except CouchbaseException: self.cluster.disconnect() raise
def connectCluster(self, username=None, password=None): if username: self.username = username if password: self.password = password try: System.setProperty("com.couchbase.forceIPv4", "false") logger = Logger.getLogger("com.couchbase.client") logger.setLevel(Level.SEVERE) for h in logger.getParent().getHandlers(): if isinstance(h, ConsoleHandler): h.setLevel(Level.SEVERE) self.cluster = CouchbaseCluster.create(env, self.server.ip) self.cluster.authenticate(self.username, self.password) self.clusterManager = self.cluster.clusterManager() except CouchbaseException: print "cannot login from user: %s/%s" % (self.username, self.password) raise
def connectCluster(self, username=None, password=None): if username: self.username = username if password: self.password = password try: logger = Logger.getLogger("com.couchbase.client") logger.setLevel(Level.SEVERE) # fh = FileHandler("java_client.log"); # logger.addHandler(fh); for h in logger.getParent().getHandlers(): if isinstance(h, ConsoleHandler): h.setLevel(Level.SEVERE) self.cluster = CouchbaseCluster.create(env, self.ip) self.cluster.authenticate(self.username, self.password) self.clusterManager = self.cluster.clusterManager() except CouchbaseException: print "cannot login from user: %s/%s" % (self.username, self.password) raise