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:
- 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.
- Enable PostgreSQL as a backing database in the project build. There are two ways to do this:
- modify
build.xml
to change thedb.postgresql
property fromfalse
totrue
; or - do not modify
build.xml
, but instead add the linedb.postgresql=true
tobuild.properties
(this will override the default setting for the same property inbuild.xml
).
- modify
- Optionally, you can disable the H2 database in a similar manner:
- modify
build.xml
to change thedb.h2
property fromtrue
tofalse
; or - do not modify
build.xml
, but instead add the linedb.h2=false
tobuild.properties
.
- modify
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).