Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have started writting rss reader in Vala, but I don't know, what database system should I use, I cannot connect to couchdb and sqlite works fine, but I would like use couchdb because of ubuntu one. I have natty with latest updates

public CouchDB.Session session;
    public CouchDB.Database db;
    public string feed_table = "feed";
    public string item_table = "item";
    public struct field {
        string name;
        string val;

    // constructor
    public Database() {
    try {
    this.session = new CouchDB.Session();
     } catch (Error e) {
           stderr.printf ("%s a\n", e.message);

    try {

         this.db = new CouchDB.Database (this.session, "test");
         } catch (Error e) {
           stderr.printf ("%s a\n", e.message);

        try {
        } catch (Error e) {
           stderr.printf ("%s aa\n", e.message);

         try {
          var newdoc = new CouchDB.Document ();
        newdoc.set_boolean_field ("awesome", true);
        newdoc.set_string_field ("phone", "555-VALA");
        newdoc.set_double_field ("pi", 3.14159);
        newdoc.set_int_field ("meaning_of_life", 42);
        this.db.put_document (newdoc);    // store document
        } catch (Error e) {
        stderr.printf ("%s aaa\n", e.message);


$ ./xml_parser rss.xmlCannot connect to destination ( aa
Cannot connect to destination ( aaa
share|improve this question
OT: Don't know Vala, but wouldn't you run the whole code block in the try-clause and then catch all the different Errors? – htorque Jan 17 '11 at 15:20
up vote 2 down vote accepted

From a performance point of view, I'd just like to say that CouchDB perhaps isn't the fastest solution when compared to something more mature like SQLite. A gwibber comparison puts SQLite as just 10 times faster.

Given that a RSS reader does a lot more SELECT than INSERT, this is something you need to be conscious of because it's going to effect your application's responsiveness.

In terms of your code, comparing it to the "official" Vala+Couch sample, you're not passing in the connection details so I'm wondering if there's an issue with the auto-detect mechanism. Couch is started on a different port each time it runs but you can get its current port through dbus:

dbus-send --session --print-reply --dest=org.desktopcouch.CouchDB / org.desktopcouch.CouchDB.getPortmethod return sender=:1.231 -> dest=:1.230 reply_serial=2

I don't know the Vala for that but manually finding out might help you get the initial connection done.

share|improve this answer
I write tutorial to my blog, I have used desktopcouch header file and I don't have to get port and so on (handled by function) – pavolzetor Jan 17 '11 at 19:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.