Red Hat

Developer Materials

Example Using the H2 Console with JBoss

  • Author:
  • Contributors: Sande Gilda
  • Last Update: Nov 08, 2013
  • Level: Beginner
  • Technologies:H2
  • Target Product:EAP

What is it?

JBoss AS bundles H2 as an in-memory, in-process database. H2 is written in Java so can run on any platform JBoss AS runs.

This is quickstart shows you how to use the H2 console with Red Hat JBoss Enterprise Application Platform. It uses the greeter quickstart as a GUI for entering data.

Note: This quickstart uses the H2 database included with JBoss EAP 6. It is a lightweight, relational example datasource that is used for examples only. It is not robust or scalable and should NOT be used in a production environment!

System requirements

The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 6.1 or later.

All you need to build this project is Java 6.0 (Java SDK 1.6) or later, Maven 3.0 or later.

Configure Maven

If you have not yet done so, you must Configure Maven before testing the quickstarts.


This quickstart depends on the deployment of the 'greeter' quickstart. Before running this quickstart, see the greeter README file for details on how to deploy it.

You can verify the deployment of the greeter quickstart by accessing the following URL: http://localhost:8080/jboss-greeter

Deploy the H2 Console

This quickstart comes bundled with a version of the H2 Console built for JBoss EAP. The changes that have been made to the stock console are described below.

Deploy the console by copying the QUICKSTART_HOME/h2-console/h2console.war to the $JBOSS_HOME/standalone/deployments directory.

Access the H2 Console

You can access the console at the following URL: http://localhost:8080/h2console.

You need to enter the JDBC URL, and credentials. To access the "test" database that the greeter quickstart uses, enter these details:

  • JDBC URL: jdbc:h2:mem:greeter-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
  • User Name: sa
  • Password: sa

Click on the Test Connection button to make sure you can connect. If you can, go ahead and click Connect.

Investigate the H2 Console

Take a look at the data added by the greeter application. Run the following SQL command:

    select * from users;

You should see the two users seeded by the greeter quickstart, plus any users you added when testing that application.

Changes to the H2 Console for JBoss EAP

To make the H2 console run on JBoss EAP, the H2 libraries were removed from the WAR and a dependency on the H2 module was added to the META-INF/MANIFEST.MF fle. The rebuilt console is provided with this quickstart.

Recent Changelog

  • Nov 8, 2013(Sande Gilda):Bz1028448 Add spaces to end of metadata so it renders with a line break in HTML
  • Oct 11, 2013(Sande Gilda):Bz1017848 Missed warning for 3 quickstarts that us the H2 database. Update logging README.html
  • Oct 7, 2013(Sande Gilda):Merge from master to 6.2.x for ER5
  • Sep 24, 2013(Sande Gilda):Remove references to JBoss AS 7 from the quickstarts
  • Sep 23, 2013(Sande Gilda):Update metadata source URLs to new repository
  • Sep 13, 2013(Sande Gilda):JDF 487 Remove as from quickstart artifactId and archive names and access URLs in README files
  • Jun 12, 2013(Sande Gilda):Modify README file internal links to use generated anchors. Remove hard coded anchors. Fixed obsolete links and other markdown rendering problems
  • Feb 12, 2013(Sande Gilda):Add quickstart source repository of record to the README files
  • Nov 30, 2012(Sande Gilda):Update greeter JDBC URL
  • Sep 11, 2012(Sande Gilda):Add target product https browse JDF 108
Your Rating: