To use Media Server with a PostgreSQL database, you must download and install a PostgreSQL server and ODBC driver, and configure Media Server to connect to the database through the driver.
The procedure describes setting up the database server using the psql command-line tool. If you prefer, you can use the pgAdmin graphical user interface. For more information, refer to the pgAdmin documentation on www.pgadmin.org.
To set up a PostgreSQL Media Server database on Windows
Download and install a PostgreSQL server. For instructions, refer to the PostgreSQL documentation on www.postgresql.org.
Once installed, the PostgreSQL server appears in the Services tab in Windows Task Manager.
Add the PostgreSQL bin directory path to the PATH
environmental variable.
This step enables you to use the command psql
to start the PostgreSQL command-line tool (psql) from the Windows Command Prompt. If the directory path is not added to the PATH
variable, you must specify the psql.exe file path in the Command Prompt to start psql.
Open the psql command-line tool:
In the Windows Command Prompt, run the command:
psql -U userName
Run a CREATE DATABASE
command to create a new database. Specify the following database settings.
Database name | Any name. |
Encoding | Must be Unicode–either UTF8 or UCS2. |
Collation | Any that is compatible with the encoding. |
Locale | Any that is compatible with the encoding. |
For example:
CREATE DATABASE myDatabase WITH ENCODING 'UTF8' LC_COLLATE='English_United Kingdom' LC_CTYPE='English_United Kingdom';
Connect to the new database using the command:
\c databaseName
Run the postgres.sql
script provided in the Media Server installation directory. This script sets up the database schema that Media Server requires. The schema is inserted inside the public
schema.
Micro Focus recommends running the following command to ensure that the script stops running if it encounters an error:
\set ON_ERROR_STOP on
Run the script using the command:
\i 'path/postgres.sql'
where path
is the script file path.
Replace backslashes in the file path with forward slashes. The psql command-line tool does not recognize backslashes in file paths.
Grant privileges to the user that Media Server will connect as. If security is not a consideration you could grant all privileges, but the required privileges are:
Database | Create Temporary Tables |
All tables | Select, Insert, Update, Delete |
All functions and stored procedures | Execute |
All sequences | Usage |
For example:
GRANT TEMP ON DATABASE databaseName TO userName; GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO userName; GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO userName; GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO userName;
where,
databaseName
|
is the name of the database that you created. |
userName
|
is the user name that Media Server will connect as. |
Open the Data Sources (ODBC) program:
In the Windows Control Panel, click System and Security.
The System and Security window opens.
Click Administrative Tools.
The Administrative Tools window opens.
Double-click Data Sources (ODBC).
The ODBC Data Source Administrator dialog box opens.
In the User DSN tab, click Add... .
The Create New Data Source dialog box opens.
Select the PostgreSQL Unicode driver from the list and click Finish.
The PostgreSQL Unicode ODBC Driver (psqlODBC) Setup dialog box opens.
Complete the data source information fields:
Data Source | The data source name (DSN). Media Server uses this string to connect to the database server. |
Database | The name of the database that you created in Step 2. |
Server | The IP address or hostname of the server that the database server is installed on. |
User Name | The user name to connect to the database server with. |
Description | An optional description for the data source. |
SSL Mode |
Whether to use SSL to connect to the database server. NOTE:
To enable SSL mode, you must also configure the database server to support SSL. For instructions, refer to the PostgreSQL documentation. |
Port | The port to use to communicate with the database server. |
Password | The password for the user account that connects to the database server. |
Click Datasource.
The Advanced Options (driverName) 1/2 dialog box opens.
Click Page 2.
The Advanced Options (driverName) 2/2 dialog box opens.
Click Apply and then OK.
The Advanced Options (driverName) 2/2 dialog box closes.
In the PostgreSQL Unicode ODBC Driver (psqlODBC) Setup dialog box, click Test to test the connection.
The Connection Test box opens containing a message describing whether the connection was successful. If the connection failed, use the information in the message to resolve any issues.
Click OK to close the Connection Test box.
In the PostgreSQL Unicode ODBC Driver (psqlODBC) Setup dialog box, click Save to close the dialog box.
In the ODBC Data Source Administrator dialog box, click OK to close the dialog box.
|