4 ms·
> Another related example, I recently learned of H2 (http://www.h2database.com/html/main.html http://www.h2database.com/html/main.html) and I honestly had to as
by pifflesnort 14y ago
> Another related example, I recently learned of H2 (http://www.h2database.com/html/main.html http://www.h2database.com/html/main.html) and I honestly had to ask myself, why is this needed? If you want an embedded SQL DB why not just use SQLite?
SQLite is native C, H2 is Java. There are significant deployment and potential stability advantages to not using native binaries in your Java software.
There have been some neat hacks to get sqlite running under Java, including using a tool that translates MIPS binaries to run under the JVM, allowing the use of libsqlite as 'native Java' code: http://nestedvm.ibex.org/ http://nestedvm.ibex.org/
This is, however, not something you'd likely want to use unless you absolutely need to interoperate with sqlite's data format.
- npsimons 14y agoI noticed that the fully native Java was a big selling point on H2. Admittedly, I'm not doing much Java these days (slight understatement), but I was under the impression that the Java interfaces to SQLite were fairly mature? Top two links in Google go to a very informative SO answer with lots of options and SQLJet. Bad sign though that "apt-cache search sqlite | grep -i java" gives no results on Debian stable. I'll grant that fully native Java is a compelling reason in some use cases ;) I'm now curious what they use for SQLite on Android, as I know fairly well that it's used all over the place there.
- ebiester 14y agoH2, more than anything else, is great for testing. It can emulate oracle and DB2 syntax, among others, to allow us to reasonably approximate a running system on our own machines, then test against the big database (which is much slower) at a later stage. Fully native java and an in-memory implementation mean that we can very quickly implement it in our systems.
- markokrajnc 14y agoI second this. We use H2 in our JUnit test cases a lot, because it is the fastest open-source in memory Java DB (tests are finished very fast).