Confused on how to use CouchDB on Android
Asked Answered
C

4

47

I want to get CouchDB running as the backend for my mobile app, replacing SQlite.

I have been incredibly confused as a newcomer to this technology because, in addition to all of similar sounding products released by Couchbase last year(Couchbase, Couchbase Single Server, Membase, Couchbase Mobile), they now seem to be dropping/combining all of them into a single project, Couchbase Server. But, that is actually Membase, not CouchDB. To top that off, the creator of CouchDB is no longer going to be working on CouchDB. Yet, there seems to be a very active community around CouchDB. Here is what I know:

  1. I understand that Couchbase, the company, no longer provides a distribution of CouchDB.

  2. I understand that Couchbase Server, the new focus of the Couchbase company, is really not CouchDB at all and it is not compatible with CouchDB. It does not implement the HTTP api that CouchDB uses, it's using a binary protocol that evolved from Membase.

  3. All of the recent information on CouchDB Mobile seems to point to Couchbase Mobile.

My questions boil down to:

Is it still possible to use CouchDB on an Android device? Specifically CouchDB, not Couchbase Server, because the APIs are not compatible

If it is still possible, how do I do it? Where is the source code? Any sample apps?

Sorry if my question gets confusing. To be honest, I am having a hard time wading through the vast collection of seemingly contradictory posts online. I just want to run CouchDB on Android! :)

Coit answered 18/2, 2012 at 18:20 Comment(2)
Something offtopic, but why do you want to use the CouchDB instead of SQLite?Coagulum
@slukian I want to take advantage of CouchDB's replication feature. The server app that coincides with the mobile app uses CouchDB.Coit
V
32

as a co-founder of Couchbase I should be able to give you a clearer understanding. I'll take your questions in turn.

1) Correct. Couchbase Server is not CouchDB. It sacrifices some of the neat things CouchDB does (HTTP interface, master/master replication) so it can do other neat things (sub-millisecond latency, gigantic clusters.) In the long long run, we'd like to get back high-performance versions of the features we had to drop. For now, we are building the fastest most reliable NoSQL database (yay) but it's not answering the same use cases as CouchDB.

2) Maybe I just answered that? More info about Couchbase Server is here: http://www.couchbase.com/couchbase-server/overview

3) Couchbase continues to invest in mobile technology. We have well tested implementations available for Android and iOS. These are based on Apache CouchDB, so they will have the feature set you are looking for. Visit here to download them: http://www.couchbase.com/wiki/display/couchbase/Couchbase+Mobile+Syncpoint (see links for iOS and Android on that page)

Going forward, we are focussing on light-weight alternatives to actually running CouchDB-based code on the device. To get CouchDB to run on the device requires the Erlang virtual machine. While it is lightweight and respectful of battery life (for a VM), it is still a VM. So we are building more lightweight sync and storage engines for mobile. TouchDB for iOS can sync with Apache CouchDB. We also have a similar project for Android. If I were starting a new project, I'd take a look at these.

Verlie answered 20/2, 2012 at 19:59 Comment(5)
Of the two options you suggested, which, in your opinion, would be the better choice to dive into? Will future releases of Syncpoint be compatible with CouchDB, or will I need to find a new solution in a few months? Lastly, how well is continuous replication/sync handled? Thanks for the help, it is much appreciated! I have the book that you co-authored sitting next to me. :)Coit
One more thing... How does GeoCouch fit into the picture?Coit
Syncpoint's sync tier will be based on Apache CouchDB, so it should sync with it just fine. That said, we may make optimizations which could break compatibility. Everything we do is open source and available for merge back tot he Apache project so chances are we'll remain compatible.Verlie
GeoCouch itself is a plugin to Couchbase Server and Apache CouchDB, so it should also continue to work with this system. As far as GeoCouch on the phone, we'd need to do a reimplementation or to integrate with existing mobile geo systems. The functionality is compelling, it's just a matter of what we can prioritize.Verlie
Now that you have deprecated TouchDB, could you comment on Couchbase Lite?Theatheaceous
E
14

The Android port of TouchDB, https://github.com/couchbaselabs/TouchDB-Android, might be interesting:

"TouchDB is a lightweight CouchDB-compatible database engine suitable for embedding into mobile or desktop apps."

It's not a drop-in replacement for CouchDB but promises an API that's basically the same and perhaps mostly importantly for you it "does support replication to and from CouchDB".

Eal answered 19/2, 2012 at 11:0 Comment(1)
Thanks for that, I will look into this. I am still hoping to find the elusive CouchDB for Android that so many internet posts mention.Coit
A
6

TouchDB has been superceded by Couchbase Lite Android and Couchbase-Lite-Android can only be used for Honeycomb and above.

Also on this date 16-Sep-13, the library is in alpha and I don't see it being used in production any time soon.

Only solution at this point seems to be parse.com, which is of course a paid solution.

Antic answered 15/9, 2013 at 20:58 Comment(1)
Github page (github.com/couchbase/Android-Couchbase) says Android 2.1 or newer, as it stands at present.Lamonica
P
4

The answers here are getting a bit dated.

Couchbase Lite is a mature, shipping product (open-source) that implements a stand-alone, fully-featured NoSQL database intended for mobile, IoT, and other uses where network connectivity is an issue or you need something lighter weight than Couchbase Server. It has broad platform support.

Couchbase Lite does synchronization. It is compatible with CouchDB.

You can find more information on the Couchbase site. For mobile, go to http://developer.couchbase.com/mobile

Edit: Couchbase Mobile 2.0 has been released. It's a significant rewrite. Couchbase Lite 2.0 replication uses a new protocol that is not compatible with CouchDB.

Priceless answered 17/11, 2016 at 19:3 Comment(1)
I think this answer is getting a bit dated too. Is it correct that Couchbase Lite 2.x is no longer CouchDb compatible?Lunge

© 2022 - 2024 — McMap. All rights reserved.