Clojure 的嵌入式(纯 Java)数据库 [英] Embedded (pure Java) database for Clojure
本文介绍了Clojure 的嵌入式(纯 Java)数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个用于 Clojure 应用程序的嵌入式数据库.也许它与任何其他 Java 应用程序的标准相同,但无论如何我更愿意听取其他人的意见.我不选择 SQLite,因为它不是纯 Java,因此独立应用程序的分发变得更加复杂.看来要走的路是Apache Derby.还有什么我应该考虑的吗?
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?
推荐答案
毫无疑问,H2
这里是设置,
(def demo-settings
{
:classname "org.h2.Driver"
:subprotocol "h2:file"
:subname (str (System/getProperty "user.dir") "/" "demo")
:user "sa"
:password ""
}
)
然后是通常的 Clojure SQL 代码:
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)"]))
这篇关于Clojure 的嵌入式(纯 Java)数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文