0

How do to integrate couchDB with Erlang to then make connection to a server.

I have a website running, I would like to make a connection between couchDB (which is running and have made a few 'documents' with values).

Checked http://wiki.apache.org/couchdb/Getting_started_with_Erlang - documentation was outdated and disc-continued

Checked https://cwiki.apache.org/confluence/display/COUCHDB/Introduction - They say that " In addition to the fantastic replication features, CouchDB's reliability and scalability is further enhanced by being implemented in the Erlang programming language. Erlang has built-in support for concurrency, distribution, fault tolerance, and has been used for years to build reliable systems in the telecommunications industry. By design, the Erlang language and runtime are able to take advantage of newer hardware with multiple CPU core"

On a general note, I need explanation on how I can make a connection to the server. How does it all work and look?

Bryn
  • 257
  • 4
  • 16
  • I think manual on the second link is simple enough (assuming you understand OTP applications & rebar). What is not clear there exactly? – Lol4t0 Oct 28 '15 at 18:50

1 Answers1

1

I tried couchbeam in one little side-project of mine -- used it along with the cowboy-webserver to make a little restful service (serve timeseries-data by 'GET'-requests). It is actually very easy to integrate, if you have a typical erlang/otp-application-stack.

Do you know how rebar works? If not, you should definitly read about it first. Just put the dependency in the rebar.config-file, and you are almost good to go. Just one additional line in the rebar-config:

{erl_opts, [{d, 'WITH_JIFFY'}]}.

To make sure, the compilation is done with the jiffy--NIFs enabled. Also: make sure, you start it, when initializing your application.

couchbeam:start().

Or, put the couchbeam-reference in the .app-file (under {applications, []}), when you create a relx-release. The connection and API-details are documented on the Github-Page.

P.S.: What do you mean by: "How does it all work and look?". It works exactly like it is documented...

P.P.S.: If you don't know what I am talking about at all, read about the OTP-Architecture first, and about rebar and releases second. I didn't understood this when I was starting with erlang, and got quite a bit confused by these concepts at first.

Community
  • 1
  • 1
Mathias Vonende
  • 1,400
  • 1
  • 18
  • 28
  • Can you link me your project? I don't know rebar. I'm new to databases, server,website connections - I know how they work together on a general note, but not specifically. Ex, what else will my db need to connect to my server and then website. Bridges and stuff like that are unclear to me. – Bryn Oct 29 '15 at 09:53
  • I haven't released It as open-source, but when I have time tonight, I will dig through my code and see, what I can do. – Mathias Vonende Oct 29 '15 at 09:54
  • Yeah, that would be helpful. Thanks – Bryn Oct 29 '15 at 13:30