What is CouchDB?
CouchDB is an open source document-oriented database now maintained as an Apache project. Some of the important features provided by CouchDB are
RESTful JSON Api to allow it to be assible from any environment using HTTP
Third partly libraries are available in many languages that make it easy to use CouchDB in your application
Schema free database, NoSQL
Supports incremental replication with bi-directional conflict detection and management.
Written in Erlang, a robust functional programming language ideal for building concurrent distributed systems
Although these features may be available in other NoSQL database what makes CouchDB interesting for mobile applications development is.
1. Synchronizing data between device and server
Take for instance a mobile application that often needs to run in an occassionaly connected scenario. Data is stored locally in case of lack of internet connectivity and then synchronized with the server once device goes online. Without CouchDB its possible to build such an application by using file system or SQLite for local data storage and writing a synchronization layer to synchronize the data between the server and the device.
Synchronization is a complicated problem and takes quite some effort to do properly. Failures have to be handled correctly and appropriate actions ned to be taken or retries made. CouchDB was created from ground up to solve this problem. With CouchDB synchronizing between the device and server becomes as trivial as calling a REST api. Synchronization can be invoked on demand or can be scheduled to run at regular intervals. Furthermore the developer has the freedom to define a filter to specify what data will be synchronized. The filter is mostly useful in cases when you want to control the amount of data synchronized. e.g in a CRM application you may want to synchronize only a few customers to the device and not the entire customer database and that can be very big.
served by CouchDB itself
replicated just like the data present in the databases
Although CouchApps may not be ideal for building all kinds of applications but if your application can be modeled as a CouchApp you get CouchDB’s scalability. With the support of CouchDB on multiple mobile devices CouchApp can also be used to create applications that can run on multiple mobile platforms like Android, iOS, Palm, etc. and that also can work in online and offline mode.
Using CouchDB on Android
We, at Neev Technologies, have been using CouchDB for one of our application. CouchDB is available as an application in the Android Marketplace. But users may get put off if they are asked to download and install CouchDB for your application to work. To ease this you can bundle an installer with your android application that detects and installs CouchDB if not already present on the device. We have tested this on Andorid (2.2, 2.3). The synchronization/replication also works quite smoothly.
With the possibility of CouchDB running on multiple mobile platforms in future, CouchDB holds a lot of
promise for developing mobile applications that need to work both in online and offline mode