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?
-
3similar to: http://stackoverflow.com/questions/4687156/how-reliable-is-h2-database – TJD Aug 21 '12 at 22:38
-
Thank you for directing me there. If there is anything extra to add I am happy to read as well, as these answers are 18 months old. – bjedrzejewski Aug 21 '12 at 22:46
-
The second answer to the linked question provides a direct link to the documentation; that link should provide the answer about whether or not the multithreading issues have changed. If not, that's a major reason not to use it in production, IMO. – Ken White Aug 21 '12 at 22:49
3 Answers
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.

- 48,905
- 14
- 116
- 132
-
8
-
5
-
2Did Your position change 3 years later? :D (with the new MVStore in mind?) – David Hofmann May 05 '16 at 01:40
-
3It depends on the use case. If you want to use H2 as a replacement for an Oracle database (for example), the situation didn't change much. But if you want to use it in embedded mode, or if you just want to use the MVStore, then it may make sense to use H2. – Thomas Mueller May 09 '16 at 11:10
-
10Let me carry on the tradition. 5 years later, do you still think that H2 in server mode for mid sized projects (up to 1 billion records overall) cannot be recommended? – Mikhail Kholodkov Jan 26 '18 at 19:02
-
9Sure, H2 (and HSQLDB, and Derby) and did improve and got more stable in the last 5 years, and are "good enough" for much more use cases. However, other databases are still more stable / have more features. – Thomas Mueller Jan 27 '18 at 07:14
-
H2 with JPA is still full of bugs... Just take a look at database growing unexpectedly and you will have an overview of where your production site can go... – TrapII Jan 31 '19 at 09:04
-
1Question is: Do you actually need all that bloat that other DB vendors put into their RMDBs ? I mean if you are usuing several layers of persistence and abstraction on top of db engine itself then most of the DB "stuff" is counter productive. Like if you are using Spring Data REST on top on JPA on top of Hibernate on top of JDBC. In many use cases the above stack with good desing bary ever hit the db except for writes. – user3852017 Apr 18 '22 at 18:19
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.

- 5,179
- 10
- 35
- 56

- 131
- 2
-
2When you say that you use only one connection- do you mean only one user accessing the database or would it be equivalent to having it deployed on JBoss and JBoss managing it? – bjedrzejewski Sep 04 '12 at 14:48
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.

- 191
- 2
- 5