Accessing CB Sync Gateway with Java Client


is it possible to use the Couchbase Java SDK the access the Couchbase Sync Gateway?
The gateway is located in the Couchbase Cloud and I am looking for the best way to access the data from Java.

Thank you

Hi Olivier,

When you say ‘access’ the data - are you referring to accessing / reading & writing data?

If so, your data would be accessed from the Java SDK by using Couchbase Server and the Java SDK directly. Your data would be accessed from the data bucket within your Couchbase Server installation.

I hope I have understood your question correctly and this answer helps. Please let me know if not!


Thank you for your answer Robin. Yes, I was referring to reading and writing (deleting) data.
Your answer seems to confirm what I was afraid of, that you have connect directly to the Couchbase Server to use the Java SDK. My problem is that I am using the Couchbase Cloud and - for now at least - it only allows direct access to the Sync Gateway and not to the Couchbase Server (as written in the CB Cloud FAQ

The Sync Gateway is merely something to run on top of one’s Couchbase Server installation. The data comes from our actual Couchbase Server installation. As stated in the docs, it is in consideration allowing accessing of the data directly from Couchbase Cloud, but at the moment, your best best is simply to use an Amazon AMI package to setup a Couchbase Server instance, or to simply set one up on your own servers.

The Java SDK indeed only interacts with Couchbase Server itsself.

I’m still coming up to speed on Couchbase, but from my testing it appears that the sync gateway exposes the bucket as a Couchdb database, so you should be able to use a Couchdb client instead of the Couchbase client. Because the sync gateway has its own metadata on the documents and in the bucket it also appears that changes you make to documents directly in Couchbase wouldn’t get synced to clients as they would if the changes had gone through the sync gateway.