Tuesday, August 7, 2007

Yaws and Mnesia

I'm playing with translating a small Web application from Rails to the Erlang web app framework Yaws. When I tried to access a Mnesia database from a page, it failed because Mnesia wasn't running. Oops. I tried running it from another erl shell, but that didn't work.

After asking on erlang-questions, here's what I've learned from the responses: You can tell Yaws about Mnesia by using the command line switch '--mnesiadir full-path-to-mnesia-directory' (but that only works when yaws is running as a daemon).

Or, you can connect to the yaws (erl) runtime and start Mnesia from there. If you started Yaws with -sname and cookie you can connect to it like any other Erlang runtime.

Finally, the simplest way to do this is to run yaws from the command line and start mnesia from within the yaws session. That's what I've done.

Thanks to the members of erlang-questions for their help.

1 comment:

desNotes said...

You might be interested in a new database project, CouchDB, written in Erlang. It is a non-relational, document-oriented database. the project is still in the alpha stage but is gathering quite a bit of interest.

CouchDB Overview