使用Cloudant复制CouchDB失败

时间:2017-08-09 16:34:46

标签: android couchdb cloudant

我有一个CouchDB数据库,我想使用Cloudant

Android设备上复制它

所以我正在做的是:

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        URI uri = null;
        File path = getApplicationContext().getDir(DATASTORE_DIRECTORY, Context.MODE_PRIVATE);
        try {
            uri = new URI("http://XXX.XXX.XXX.X:XXXX/my_database/");
        } catch (URISyntaxException e) {
            Log.d("onCreate",e.getMessage());
        }

        DocumentStore ds = null;
        try {
            ds = DocumentStore.getInstance(path);
        } catch (DocumentStoreNotOpenedException e) {
            Log.d("onCreate",e.getMessage());
        }

// Create a replicator that replicates changes from the remote
// database to the local DocumentStore.
        Replicator replicator = ReplicatorBuilder.pull()
                .from(uri)
                .to(ds)
                .addRequestInterceptors(new BasicAuthInterceptor("myUser:myPass"))
                .build();

// Use a CountDownLatch to provide a lightweight way to wait for completion
        CountDownLatch latch = new CountDownLatch(1);
        Listener listener = new Listener(latch);
        replicator.getEventBus().register(listener);
        replicator.start();
        try {
            latch.await();
        } catch (InterruptedException e) {
            Log.d("onCreate",e.getMessage());
        }
        replicator.getEventBus().unregister(listener);
        if (replicator.getState() != Replicator.State.COMPLETE) {
            Log.d("onCreate","Error replicating FROM remote");// error
            Log.d("onCreate",(listener.errors).toString());// error
        } else {
            Log.d("onCreate",(String.format("Replicated %d documents in %d batches",
                    listener.documentsReplicated, listener.batchesReplicated)));
        }
    }

我收到两个错误;

  

onCreate:从远程onCreate:

复制错误      

onCreate:[java.lang.RuntimeException:无法确定是否_bulk_get   支持端点]

我做错了什么?

0 个答案:

没有答案