I am recently considering making an application that uses h2 database as its main database (because it comes with JBoss), but I am bit worried about that. I have read in a few places (discussion boards mainly) that one should not use h2 in production. Are there specific reasons for that?
It can be embedded in Java applications or run in the client-server mode. Mainly, H2 database can be configured to run as inmemory database, which means that data will not persist on the disk. Because of embedded database it is not used for production development, but mostly used for development and testing.
An open-source Java SQL database, H2 is an in-memory solution that eliminates the need to store data on disk, and is one of the most popular Maven packages, having roughly 7,000 artifact dependencies, Tracked as CVE-2021-42392, the newly disclosed vulnerability has been lurking in H2 since version 1.1.
H2 is an open source Java SQL Database. It can be run in both embedded and server mode. It is widely used as an In-memory database. In-memory database relies on system memory as oppose to disk space for storage of data.
This functionality is deprecated since version 4.4. The functionality is still supported and maintained, but it will no longer be extended.
The main reasons not to use H2 (or HSQLDB, or Derby) for production are:
Probability of critical bugs: compared to the 'big' databases Oracle, IBM DB 2, MS SQL Server, MySQL, PostgreSQL, the Java databases are relatively new and therefore possibly not as stable (have bugs). Please note this is true for all newer products, including NoSQL databases, and new releases of the 'big' databases. Generally, the more a product is tested, the less the probability of bugs. Of course it depends on your use case whether it makes sense to pay (possibly a lot of money) for this advantage. In any case you will need to backup the data, in case of hardware failure for example.
Missing features and optimizations: the 'big' databases have more features and optimizations for special use cases. Whether or not you need those features is up to you.
Commercial support: it's easier to get support for bigger databases. Please note commercial support is available for H2 as well. HSQLDB also provides commercial support. IBM used to provide support for Apache Derby (well, IBM Cloudscape), but I believe they stopped.
In my personal experience, H2 version 1.2.147 seems very reliable, 100% success in about 60 installations, but my clients only have relatively small databases (400 MB are the bigger sizes) and my program uses only one connection (lol), only recently I started to use more than one connection but with multi_threaded
false. I had corruptions with some previous versions and I am scared to try newer versions yet.
For me me there is no reaseon not to use H2DB in production for mid sized projects. We deployed a production system for about fifteen clients all using H2DB, we experienced very easy installations and backups and yet zero problems regarding the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With