java 与应用程序一起打包的最轻的数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2431546/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 21:06:50  来源:igfitidea点击:

Lightest Database to be packed with an application

javadatabasehibernateormembedded

提问by Yatendra Goel

I am developing a Java Desktop Application and want a light databasethat can be used with Hibernateand that can be packed with an application.

我正在开发一个 Java 桌面应用程序,并且想要一个light database可以Hibernate与应用程序一起使用并且可以与应用程序一起打包的应用程序。

I was going to use Derbydatabase. It's size is near 2 MB. But before that I wanted to have views of experts on SO.

我打算使用Derby数据库。它的大小接近 2 MB。但在此之前,我想了解专家对 SO 的看法。

Will it work with Hibernate?

它会与Hibernate?

Actually, I am new to Hibernate and was studying that it requires a Dialectfor a database so Is Hibernate has dialect for Derby?

实际上,我是 Hibernate 的新手,正在研究它需要Dialect一个数据库,所以 Hibernate 有方言Derby吗?

回答by Pascal Thivent

JavaDB(Sun's supported distribution of the open source Apache Derby), HSQLDB(not very active) and H2(the successor of HSQLDB) are all 100% Java embeddable database engines and can allbe used with Hibernate (i.e. there are dialect for them). Refer to this pageand this one.

JavaDB(Sun 支持的开源 Apache Derby 发行版)、HSQLDB(不是很活跃)和H2HSQLDB继承者)都是 100% Java 可嵌入数据库引擎,并且可以与 Hibernate 一起使用(即它们有方言) . 请参阅此页面页面

HSQLDB has the smallest footprint (~700 KB) of all of them. But feature wise (see this comparison), H2 is the clear winner and its footprint (~1 MB) is still smaller than Derby's one (~2 MB).

HSQLDB 的占用空间最小(~700 KB)。但在功能方面(请参阅此比较),H2 是明显的赢家,其占用空间(~1 MB)仍然小于 Derby 的占用空间(~2 MB)。

The final choice depends on what you need but H2 is a good compromise of features and size (in other words, a big competitor). Have a look at the mentioned comparison.

最终的选择取决于您的需要,但 H2 是功能和大小的良好折衷(换句话说,是一个很大的竞争对手)。看看上面提到的比较。

回答by Daff

I would recommend HSQLDB. It is small and fast and runs fine with Hibernate. Hibernate has a dialect for the Derby DB as well (haven't used it though and I think it is not officially supported by Hibernate yet).

我会推荐HSQLDB。它体积小、速度快,在 Hibernate 中运行良好。Hibernate 也有用于 Derby DB 的方言(虽然还没有使用它,我认为 Hibernate 还没有正式支持它)。

回答by Aurril

Another Alternative would be SQLite.

另一种选择是 SQLite。

Hibernate and SQLite

休眠和 SQLite

回答by Hugues Van Landeghem

You can also try Firebird

你也可以试试火鸟

There is an embedded version and a client/server mode version

有嵌入式版本和客户端/服务器模式版本

Here an link to hibernate supported database

这里是休眠支持数据库的链接