TrustRadius: an HG Insights company

H2 Database

Score8 out of 10

2 Reviews and Ratings

What is H2 Database?

H2 Database Engine is an open source, embeddable database management system (RDMS) written in Java.

For simplicity

Pros

  • Simple setup, only needs a dependency added to application & few config lines.
  • Quick startup
  • Easy to use, existing code for MySQL works with H2 too

Cons

  • There's a warning in official FAQ "Is it Reliable?"-section which makes it seem like H2 is not yet a mature product.
  • If raw SQL queries are used there maybe be differences between MySQL & H2. ORM library should be used.
  • Support seems to be community-based only.

Most Important Features

  • Easy setup, developers don't need to setup databases for running tests
  • Persistence, although H2 is often referred as in-memory database, saving the database to disk is easy and data stays between application restarts
  • MySQL compatibility

Return on Investment

  • Doesn't take time from developers, once it's configs are set up for testing it works in everyone's development environments
  • Easy to integrate in application, no need to setup separate database software, no maintenance
  • No need to deal with infrastructure related issues/costs - database runs in same machine as the application that uses it.

Alternatives Considered

MySQL

Other Software Used

Amazon Relational Database Service (RDS), Apache Tomcat, MySQL

H2 Database Engine is the in-memory database for your automated tests

Pros

  • Can run as an in-memory database.
  • Simple and quick to get started with, and is light weight (only 2MB).
  • SQL compliant so it compatible with most relational databases.

Cons

  • There really is not a lot to say here as H2 Database Engine is not a general purpose database such as PostgreSQL or MySQL, so it has a niche use case for being an in-memory database, and it is very good at doing that. Perhaps one slight improvement would be some SQL queries that work with MySQL or PostgreSQL do not work with H2 Database Engine, and so if H2 Database Engine is used as an in-memory replacement for testing, that would create false negatives.
  • If H2 Database Engine can support some NoSQL databases, it would be fantastic.

Most Important Features

  • Light weight and in-memory
  • SQL compliant

Return on Investment

  • Improved code quality by allowing the team to run automated test cases.
  • Reduced infrastructure cost as we no longer need to have dedicated databases just for testing.

Alternatives Considered

SQLite

Other Software Used

SQLite