4

I don't understand how to make a connection with nitrogen and couchdb using ecouch, because I have a error on this connection CAUGHT ERROR: error-undef [{ecouch,db_info,["test_suite_db"]} I put ecouch in my erlang library path and I create a symlink to support/include.mk (even I don't know if it has necessary). Or if anyone know a database how can connect with nitrogen and who to make this connection.

user331852
  • 53
  • 3

1 Answers1

1

Sorry if this question is simplistic but I'm unsure on your experience level. But you did run the make command in the ecouch directory right?

Also. Consider couchbeam or erlang_couchdb. Both have far better documentation.

Jon Gretar
  • 5,372
  • 1
  • 23
  • 22
  • I do the make command make[1]: Entering directory `/usr/local/lib/erlang/lib/ecouch-read-only/src' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/usr/local/lib/erlang/lib/ecouch-read-only/src' Only I want to connect a database with nitrogen, I don't know how to do it, I try with postgresql and erl4db but it don't work. I have couchdb version 11, and this database work fine by itself, but with nitrogen no. – user331852 Jun 08 '10 at 15:08
  • when I try to create a table I have this error: 1> inets:start(). ok 2> application:start(ecouch). ok 3> ecouch:db_create("test"). {ok,{obj,[{"error",<<"unauthorized">>}, {"reason",<<"You are not a server admin.">>}]}} How can I fix it? – user331852 Jun 08 '10 at 15:39
  • Ahh. Your CouchDB server is password protected. Haven't played with ECouch a year. But looking at the sources it seems that you need to edit the ebin/ecouch.app file and edit the line that says {mod, {ecouch, {"127.0.0.1", "5984", [], []}}}, to someting like {mod, {ecouch, {"127.0.0.1", "5984", "username", "password"}}}, – Jon Gretar Jun 08 '10 at 18:39
  • First thanks for your response, but I have this error now: CAUGHT ERROR: exit-{noproc, {gen_server,call, [ec_listener,{get,"/test_suite_db",[]},30000]}} [{gen_server,call,3}, {ecouch,db_info,1}, {blog_posts,get_posts,0}, {web_index,body,0}, – user331852 Jun 08 '10 at 19:18
  • Function get_posts looks like: get_posts() -> {ok, Return} = ecouch:view_access("myblog", "nitrogen", "flat"), RawRows = json_obj:get_value("rows", Return), F = fun(X) -> json_obj:get_value("value", X) end, Rows = lists:map(F, RawRows), lists:reverse(Rows). – user331852 Jun 08 '10 at 19:21