Use java-memcached-client to talk to CouchDB (not couchbase 2.0)
Tue, 08/09/2011 - 13:26
Is it possible to use the latest Java SDK to interact with a CouchDB 1.1 instance or is it wired to talk to a couchbase 2.0 instance with its membase and query interfaces? I can't seem to find a convenient CouchDB Java driver (I tried Ektorp and others but I am not happy). The java-memcached-client client looks better to me.
It's meant to be used with Couchbase Server. Let me elaborate though on why you can't use it. Before I do though I want to mention that Couchbase server support both the CouchDB and memcached protocol so our java client is sending the same messages it would send whether it was talking to CouchDB or Couchbase. Other CouchDB clients could use Couchbase and not notice any difference.
The reason it won't work with CouchDB is that we actually mix CouchDB calls and memcached calls inside the client. We do this because the memcached protocol is much more high performance than the CouchDB protocol (which is just http). As a result our java client would send commands to CouchDB that CouchDB just wouldn't understand. The second issue has to do with how we establish connections to Couchbase. Couchbase has a cluster management layer that the client communicates with before it makes any individual connections to the servers in your cluster. Since CouchDB doesn't have this you wouldn't be able to easily connect.
With that said it would be relatively easy to strip the parts that you would need to talk to just CouchDB. Then adding a little bit of extra functionality to comlpete all of the commands you would need to have a full fledged CouchDB client wouldn't be too difficult. So if we hear of more intrest in making a CouchDB java client we certainly can. If your interested doing any of this I would be happy to guide you through the process.