Database Configuration - PostgreSQL
PostgreSQL is an open source database that can be downloaded from the Internet. For more information, see the PostgreSQL web site at:
It’s assumed that PostgreSQL is already installed .
One notation used is <FMEServerDir>, which is the installation directory of FME Server. In Windows, this is typically C:\Program Files\FMEServer.
It’s also assumed that you have JRE 5 or higher and PostgreSQL database installed before you proceed further. If you want to use the JDBC driver, there are several steps to perform.
If you are upgrading, you should back up any job history you want to keep.
This section describes how to configure a PostgreSQL database. You can configure this database from other PostgreSQL database tools, depending on your personal preference.
For a PostgreSQL database configuration, various SQL scripts are provided to assist you. These SQL scripts are located in the following directory:
<FMEServerDir>\Server\database\postgresql
Note: This directory refers to the machine on which the FME Server Core is installed (not the machine on which the database server is installed). To run these scripts, you must transfer this directory to the database machine, or reference it through a UNC path.
- postgresql_createUser.sql – This script creates the FME Server database user and password, and grants all required permissions to this user. By default, both the user name and password are fmeserver.
- postgresql_createDB.sql – This script creates the FME Server database.
- postgresql_createSchema.sql – This script creates all FME Server related tables, indexes, views, and triggers.
- postgresql_dropUser.sql – This script drops the FME Server database user.
- postgresql_dropDB.sql – This script drops the FME Server database.
Using the Command Prompt
To use the command prompt to configure the database, follow these instructions:
- Install PostgreSQL SQL shell (psql) if you haven’t done so already.
- Open psql and log on as a user with the appropriate privileges:
- Create an FME Server database user as follows:
- From the SQL prompt, run the postgresql_createUser.sql script by entering the following command:
- By default, the provided SQL script creates an FME Server database user named fmeserver with the password fmeserver:
- Create an FME Server database.
- Quit psql and log on as the FME Server database user.
- Create the FME Server database schema as follows:
\i '<FMEServerDIR>/Server/database/postgresql/postgresql_createUser.sql'
From the SQL prompt, run the postgresql_createDB.sql script by entering the following command:
\i '<FMEServerDIR>/Server/database/postgresql/postgresql_createDB.sql'
By default, the provided SQL script creates an FME Server database named fmeserver and grants all privileges on the database to user fmeserver.
From the SQL prompt, run the postgresql_createSchema.sql script by entering the following command:
\i '<FMEServerDir>/Server/database/postgresql/postgresql_createSchema.sql'
By default, the provided SQL script creates all FME Server related tables, indexes, views, and triggers.
This section describes configuring PostgreSQL from both the command prompt and a user interface, such as the PostgreSQL Query Browser and the PostgreSQL Administrator.
For PostgreSQL configurations, various SQL scripts are provided to help with PostgreSQL database configuration. These SQL scripts are located in the <FMEServerDir>/Server/database/postgresql/ directory of the FME Server Core machine.
Note: This directory refers to the machine on which the FME Server Core is installed (not the machine on which the database server is installed). To run these scripts, you must transfer this directory to the database machine, or reference it through a UNC path.
- postgresql_createUser.sql – This script creates the FME Server database user and password, and grants all required permissions to the FME Server database user. By default the user is named fmeserver and the password is fmeserver.
- postgresql_createDB.sql – This script drops the FME Server database and creates a new one with the required FME Server tables. By default this database is named fmeserver. Be careful when running this script because it drops the existing FME Server database.
postgresql_createSchema.sql
– This script creates all FME Server related tables, indexes, views, and triggers.- postgresql_dropDB.sql – This script drops the existing FME Server database, which is named fmeserver by default.
- postgresql_dropUser.sql – This script drops the FME Server database user.
Note: This script must be run as user fmeserver.
Using the Command Prompt
To use the command prompt to configure the database, follow these instructions:
- Install PostgreSQL Server if you haven’t already.
- Open a command prompt and change to the following directory, which contains the PostgreSQL SQL scripts:
-
Run the postgresql program with the postgresql_createUser.sql script:
psql -d postgres -h <hostname> -p <port> -f postgresql_createUser.sql
-
Run the postgresql program with the postgresql_createDB.sql script:
psql" -d postgres -h <hostname> -p <port> -f postgresql_createDB.sql
-
Run the postgresql program with the postgresql_createSchema.sql script, as user fmeserver:
psql -U fmeserver -d fmeserver -h <hostname> -p <port> -f postgresql_createSchema.sql
<FMEServerDir>/Server/database/postgresql/
Note: If you drop the FME Server database and login user, run the postgresql program with the appropriate postgresql_dropDB.sql or postgresql_dropUser.sql scripts.
After Database Creation
On the machine on which the FME Server database server is installed, open <PostgreSQLDir>\data\pg_hba.conf
.
- Change the following lines:
- Restart the FME Server Database service.
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
to:
host all all 0.0.0.0/0 md5
host all all ::/0 md5