incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <...@jsonified.com>
Subject Re: How to connect CouchDB from Tomcat with jquery not any javaProgram
Date Thu, 04 Oct 2012 10:27:49 GMT
On 4 October 2012 11:31, lenin <leningovi@gmail.com> wrote:
> what is the way to achieve my goal....

Hi Lenin,

> How to connect CouchDB from Tomcat with  jquery not any javaProgram.

I suspect there's a bit of a gap between your aspirations, & your
understanding of the components. Apologies if I'm wrong, coz this
email is not intended to come across as a complete arse.

CouchDB is a database that's accessible *only* over HTTP -- i.e. it
includes its own webserver. You can run your own couch, or use a
hosted one, but in any case your application running in Tomcat or
where-ever will need to be able to access CouchDB over HTTP.

JQuery is a framework that runs inside web browsers. You can get your
jquery stuff to talk directly to couchdb (which is what the futon
admin interface does). And as CouchDB serves HTTP as well, you can
embed your HTML files (jquery.js, index.html & all the rest) inside a
CouchDB Design Document, so that the database access & the web served
files come from the same Origin. This is very handy.

Given all that, I don't see why you want to include Tomcat in the mix.
Unless you have some cool Java Beans stuff to do in which case it
probably makes lots of sense. But then you need to tell us about that
too.

If you *do* need Tomcat, then you need to decide if your front end
jquery code running in the browser *really* needs to talk to the Couch
database via Tomcat. You'll be serialising & reinstantiating the JSON
docs out of CouchDB unnecessarily even before you do any actual
processing in Tomcat. It will be much faster to have the browser talk
to couchdb directly.

So where to now?

- ditch tomcat & keep things simple
- clarify what you want to do with tomcat & you're probably better off
asking that on a tomcat list

If you are a Java person then ektorp is pretty popular library for
talking to CouchDB.

A+
Dave

Mime
View raw message