5 ms·
Embedded databases where the db is a single file are the bomb. We build several products in Java using H2 as our database. What a pleasure. Full SQL support, z
by grandinj 6y ago
Embedded databases where the db is a single file are the bomb.
We build several products in Java using H2 as our database. What a pleasure. Full SQL support, zero configuration/installation/etc.
Just copy data-files/dbs around using normal file tools.
Just start up one process and your app is ready.
- xrendan 6y agoThis is my first time hearing about H2, what's the benefit of H2 over sqlite?
- mmcdermott 6y agoI think the big one is that it's written in Java so it runs seamlessly on the JVM. While JNI allows you to wrap native libraries for the JVM, it tends to mix poorly with the common artifact management and deployment pipelines. The main use I've put it to over the years is as an in-memory database for integration tests.
- mbreese 6y agoDerby is/was the other alternative for an in JVM database. For a long time, it was possible/practical to use SQLite from Java. Now, it is, but not if you want to keep things as pure Java (and another commenter mentioned). But really, in my mind, that’s the only real benefit for H2, the fact that’s it’s pure Java. So if you need that, you’re good. But otherwise, I try to stick to SQLite.
- bobthebuilders 6y agoI mean H2 is only really useful in Java, but the perf compared to sqlite in Java is equal or better due to better JDBC integration and not having to deal with JNI.
- OOPMan 6y agoIt integrates better with JVM