Embedded H2
6.2.1.5.3. Using the embedded H2 database

IAM may be started with an embedded H2 database which can be used for testing and demoing. It roughly offers the following features:

  • Implemented as "IAM module" (like the Loginapp, Adminapp, etc.)
  • H2 Web Console (web application with database browser and SQL shell)
  • Automatic initial schema creation (if no schema deployed)

To enable the embedded H2 database, add "h2" to the list of IAM modules in the instance configuration:

Enable H2 in IAM instance (together with Adminapp and Service Container in this example)

## Applications to enable. Comma separated list.
## Possible values: adminapp,loginapp,transaction-approval,service-container,webservice,h2
iam.modules = adminapp,service-container,h2

To configure the database, the following instance properties may be used (values shown in the example are default values):

H2 Properties in instance.properties

# URL path of the H2 web console
iam.h2.url.path = /${instance.name}-h2

# Directory where H2 data is kept
iam.h2.data.dir = instances/${instance.name}/h2

# JDBC URL to connect to the database (choose a different port for each instance)
iam.h2.jdbc.url = jdbc:h2:tcp://localhost:9001/iamdb

# JDBC username
iam.h2.jdbc.user = airlock

# JDBC password
iam.h2.jdbc.password = ....

Run the following command to get up-to-date H2 default settings:

iam default-parameters | grep iam.h2

If separating the Loginapp from the Adminapp of IAM (see 7.2. Sandboxing with profiles), it is a good idea to run the H2 database in the Adminapp part.