开发者

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开发者_StackOverflow go is Apache Derby. Anything else I should consider?


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)"]))


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.


h2

oracle Berkley DB


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


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.


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/


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜