Java中基于文件的数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3575451/
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
File based database in Java
提问by user
Are there any libraries create programs in java that uses a file as a database and you don't have to install database services on the computer you are going to use it?
是否有任何库在 java 中创建使用文件作为数据库的程序,并且您不必在要使用它的计算机上安装数据库服务?
采纳答案by duffymo
回答by clamp
there is a very good java binding for SQLitedatabases called SqliteJDBC:
SQLite数据库有一个非常好的 java 绑定,称为 SqliteJDBC:
回答by Manuel Selva
We are successfully using http://www.sqlite.org/along with http://www.zentus.com/sqlitejdbc/as JDBC driver.
我们成功地使用http://www.sqlite.org/和http://www.zentus.com/sqlitejdbc/作为 JDBC 驱动程序。
回答by MarrLiss
For example HSQLDBor Apache Derbycan run in Embedded mode.
例如,HSQLDB或Apache Derby可以在嵌入式模式下运行。
回答by Awaken
Derby can run in the Embedded mode as mentioned above. It actually is included in Java 6 SE and called Java DB instead (although it is really just Apache Derby). It is quite easy to use, although the default database tool (ij) isn't great. I would use something like SQuirreL SQL to view the data.
如上所述,Derby 可以在嵌入式模式下运行。它实际上包含在 Java 6 SE 中并改为称为 Java DB(尽管它实际上只是 Apache Derby)。它非常易于使用,尽管默认的数据库工具 (ij) 不是很好。我会使用类似 SQuirreL SQL 的东西来查看数据。
回答by Fabian Steeg
回答by Alexander
What about H2?
什么H2?
H2 is a relational database management system written in Java. It can be embedded in Java applications or run in the client-server mode. The disk footprint (size of the jar file) is about 1 MB. (Wikipedia)
H2是用Java编写的关系数据库管理系统。它可以嵌入到 Java 应用程序中或以客户端-服务器模式运行。磁盘占用空间(jar 文件的大小)约为 1 MB。(维基百科)
回答by Alexander
If anyone looks for a very simple file based databasetry this older low-level databasewhich is very easy to understand. It is a tutorial, but you can download the full source code here.
如果有人在寻找一个非常简单的基于文件的数据库,请尝试使用这个很容易理解的较旧的低级数据库。这是一个教程,但您可以在此处下载完整的源代码。
Basically it uses a simple RandomAccessFile and standard java serialization, so you can store everything serializable and you don't need any special configuration or Annotations in your objects to use it. No need for any libraries.
基本上它使用一个简单的 RandomAccessFile 和标准的 java 序列化,因此您可以存储所有可序列化的内容,并且您不需要在对象中进行任何特殊配置或注释来使用它。不需要任何库。
回答by kervin
MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.
MapDB 提供由磁盘存储或堆外内存支持的并发映射、集合和队列。它是一个快速且易于使用的嵌入式 Java 数据库引擎。
https://github.com/jankotek/MapDB