Is SQLite the most appropriate thing to use for an embedded database? [duplicate]

安稳与你 提交于 2019-11-30 15:53:31

Another database to consider is H2. It is an embedded database engine completely written in Java so you have the benefit of full unicode (16 bit) character support that Sqlite does not have. Other embedded databases are HSQLDB and Derby.

sqlite doesnt need any requirement on the server ?

Correct. It does not. Neither does H2.

just install the final application and sqlite works fine in my application ?

Correct. As long as you include Sqlite or H2 in your WAR (or unpack it into your jar), it will work fine.

What is the difference between a Wrapper and a Driver ?

Depends on the usage. I think Sqlite is talking about the fact that when you use the JDBC driver for Sqlite, it is actually a wrapping of the Sqlite C code inside of the driver. Typically the JDBC driver talks to a remote database. The Xerial driver actually is simulating the Sqlite C code in a little VM -- strange but it seems to work well.

H2 also is that way with the "driver" actually doing the database operations just that it was written in Java so you don't need the C wrapper.

Plus I see there exists a "pure java implementation" : SQLJet is it more or less optimized?

This is the first I've heard of Sqljet so I'm not sure. The Xerial Sqlite driver is what I've used and it's performance seems to be good.

Finally what would you use in my situation?

I'd use H2 myself for the native Java features.

  1. Yes SQLite doesn't require a server.

  2. One very simple solution for development is using SQLLite by embedding it in your source code, with a little stub data. You can then commit your database to your version control system (i.e. I use github, its super easy to do this) as a single file. This is, obviously, not a good production method, but it is a good way to create a single development version.

  3. A Wrapper is a program which facades another program by allowing you to access its functionality through a different interface. For example, eclipse "wraps" many java programs that we use in everyday development for us in a convenient GUI. Whereas a Driver is a program that is needed to launch an existing application. For example, in a java application, we might have a main class that can be thought of as a Driver for entry point to the application.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!