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, the h2 IAM module must be added to the list of loaded iam.modules in the instance properties file. By default, this file is stored under /home/airlock/iam/instances/auth/

Uncomment and add h2 to the iam.modules line to enable the H2 database module for the IAM instance:

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

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

## Path to modules (e.g. http://localhost:8080/auth-admin)
#iam.h2.url.path = /${}-h2

## The embedded H2 database is for testing purposes only. 
## For production please refer to the documentation for more information. 
## When h2 is enabled in iam.modules, an embedded H2 database will be started with Airlock IAM = instances/${}/h2 
#iam.h2.jdbc.url = jdbc\:h2\:tcp\://localhost\:9001/iamdb 
#iam.h2.jdbc.user = airlock 
#iam.h2.jdbc.password = password

To display the current H2 settings, run: iam default-parameters | grep iam.h2

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