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 was installed (not the machine on which the database is installed).
- 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 and password are names 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.
Note: The preceding example assumes your user name and password are fmeserver.
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 machine on which the FME Server core was installed (not the machine on which the database is installed).
- 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.
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
After the database has been created, see Post-Configuration Scripts for an additional step.