Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 941
pupeno Avatar asked Aug 03 '11 06:08

pupeno


1 Answers

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)"]))
like image 180
Nicolas Modrzyk Avatar answered Sep 23 '22 19:09

Nicolas Modrzyk