-1

It's possible to connect an Android application directly to a Couchbase server database?.

It's possible to get a Document from Couchbase's bucket and use it from an Android application?.

Thank you.

code lost
  • 13
  • 1
  • 5
  • They have something called [couchbase-lite](https://github.com/couchbase/couchbase-lite-android) it's an android embeded database – Dan Ionescu Mar 05 '17 at 20:43
  • But.. if I need centralize the database in a server?, can't I get documents directly from the server? – code lost Mar 05 '17 at 20:56
  • 1
    "connect an Android application to X" is such a broad thing to say. Do you mean an automatic way? Of course the documents in the bucket are simply there and can be manipulated via the Couchbase Server REST API, but manipulating them directly is discouraged because it will break sync between devices in many cases. That is the job of Sync Gateway. – borrrden Mar 06 '17 at 13:14
  • Yes, you are right thank you borrrden – code lost Mar 06 '17 at 13:21

1 Answers1

1

tl;dr: Use Sync Gateway.

Couchbase Sync Gateway is designed to be a web edge service that you use to access data. In the most typical scenario Sync Gateway connects to a back end Couchbase Server cluster.

You could in theory use one of the client libraries to access Couchbase Server directly. You really don't want to do this for several reasons.

  1. The client libraries have different expectations around network latency and availability.
  2. They don't currently (as of Couchbase Mobile 1.4) support the meta data needed for syncing.
  3. You'd need to expose your server which raises your security risk profile

The system architecture has all this in mind, which is why it's designed the way it is.

Hod
  • 2,236
  • 1
  • 14
  • 22
  • Such a shame the smart client libraries don.t support the meta data for syncing. It takes away all the simplicity of syncing across several platforms on Couchbase-lite/Sync-Gateway/Couchbase server solutions. – 1vand1ng0 Mar 24 '17 at 23:01
  • 1
    @1vand1ng0 it's being worked on. Don't have dates, but stay tuned. – Hod Mar 25 '17 at 18:16
  • 1
    Update: Combined system will allow integration such that you no longer need to write solely through Sync Gateway (that is, apps can write to Couchbase Server with the client libraries and sync will work). Check Couchbase site for more info. @1vand1ng0 – Hod Jul 20 '17 at 18:00
  • cool. We already wrote another layer in our solution to connect to the sync Gateway, based on examples on the Couchbase github page. In future iterations we will try the new solution provided by couchbase. Thanks for the update, otherwise I would not have know about this. Full support to sync from couchbase server its going to make CB even better! – 1vand1ng0 Jul 21 '17 at 21:43