Pablo Fernandez
Pablo Fernandez

Reputation: 287400

Embedded (pure Java) database for Clojure

I'm in need for an embedded database for a Clojure application. Maybe it's the same criteria as for any other Java application but I rather get some other people's opinion anyway. I'm not picking SQLite because that's not pure Java so distribution of a standalone application gets much more complex. It seems the way to go is Apache Derby. Anything else I should consider?

Upvotes: 18

Views: 6116

Answers (8)

leventov
leventov

Reputation: 15273

Another option to consider is a key-value store Chronicle Map, because it's pure Java and provides a vanilla Java Map interface, so working with it should be very simple using Clojure.

Upvotes: 0

M Smith
M Smith

Reputation: 2028

I am using https://github.com/clojurewerkz/archimedes which allows you to specify a backend later.

Upvotes: 1

Alex Miller
Alex Miller

Reputation: 70211

Have you looked at FleetDB? It's a Clojure database with a JSON protocol and clients in several languages. I suspect you could probably run it embedded without working too hard at it.

Upvotes: 4

polypus74
polypus74

Reputation: 429

If you don't mind NOSQL, neo4j is an embeddable graph db with transactions, licensed under the GPL. The most up to date bindings I've found are https://github.com/hgavin/borneo

There is also an interesting graph db project in clojure with pluggable backends: https://github.com/flatland/jiraph

The still quite young but promising looking OrientDB might be worth a look: http://www.orientechnologies.com/orient-db.htm

http://github.com/eduardoejp/clj-orient

Then there's http://jdbm.sourceforge.net/

Upvotes: 1

Bryan Pendleton
Bryan Pendleton

Reputation: 16349

I think Derby makes an excellent 100% Java embedded database, and it's useful for a wide variety of applications, well-maintained by an active community, and very well documented.

Upvotes: 2

yazz.com
yazz.com

Reputation: 58786

I used an embedded database, H2 within clojure and used clojureQL to access it. Be warned though that since the database is in process you should not use this for large amounts of records (> than 10,000s in a single table) as you will get huge performance problems as the database and your code will both be sharing the same JVM

Upvotes: 2

zmila
zmila

Reputation: 1660

h2

oracle Berkley DB

Upvotes: 3

Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14197

Without a doubt, H2

Here are the settings,

 (def demo-settings
   {
    :classname   "org.h2.Driver"
    :subprotocol "h2:file"
    :subname     (str (System/getProperty "user.dir") "/" "demo")
    :user        "sa"
    :password    ""
   }
  )

And then the usual Clojure SQL code:

  (with-connection demo-settings 
    (create-table :DEMO_TABLE
           [:M_LABEL "varchar(120)"]
           [:M_DATE "varchar(120)"]
           [:M_COMMENT "varchar(32)"]))

Upvotes: 28

Related Questions