Project

General

Profile

Database Choice

By default, the Hotel sample project is configured to use the H2 database. H2 was chosen for the demo because it is implemented in Java and when used in embedded mode (as it is in this case), it requires virtually no deployment effort. Since there is no installation or configuration of an external database, this is the simplest way to go if you are trying to get the demo up and running quickly.

The project build also provides the option to use a PostgreSQL database as the back end. If this is your first look at FWD and you just want to get the sample application going, we recommend staying with the default of using H2 as the back end. However, if you already have gotten the sample application running and now you want to confirm that a PostgreSQL back end can be used, here is what you need to do:

  1. Install and configure the PostgreSQL database server, create a database cluster, and install the base support for PL/Java. This process is documented in Database Server Setup for PostgreSQL on Linux (note: these instructions are for Linux only at this time). Go only as far as restarting the database cluster. The sample application project build will do the rest.
  2. Enable PostgreSQL as a backing database in the project build. There are two ways to do this:
    • modify build.xml to change the db.postgresql property from false to true; or
    • do not modify build.xml, but instead add the line db.postgresql=true to build.properties (this will override the default setting for the same property in build.xml).
  3. Optionally, you can disable the H2 database in a similar manner:
    • modify build.xml to change the db.h2 property from true to false; or
    • do not modify build.xml, but instead add the line db.h2=false to build.properties.

If the PostgreSQL server was installed successfully and a FWD database cluster was created and configured properly, a PostgreSQL database for the sample application will be created and populated with data when you next deploy the project (see below).