Troubleshooting PostgreSQL®
Virus Scanner
- Check that the port used for the PostgreSQL® communication (by default 5432) is not blocked by the firewall.
PostgreSQL® in a Distributed System
If PostgreSQL® is used in a distributed system, the same database username must be used on each of these systems. When multiple distributed WinCC OA projects share a single database instance (DB schema), the projects must use the same database connection and the same database username.
-
Specify the address of the host that needs to access the database in the
pg_hba.conf file
. - For Windows: C:/Program Files/PostgreSQL/13/data/pg_hba.conf
- For Linux: /var/lib/pgsql/data/pg_hba.conf. Fore more information, see the C:/Program Files/PostgreSQL/16/data/pg_hba.conf file.
-
Set the entry
listen_addresses = '*'
in the postgresql.conf file to enable connections from remote hosts to the PostgreSQL® database. - For Windows: C:/Program Files/PostgreSQL/16/data/postgresql.conf
-
For Linux: /var/lib/pgsql/data/postgresql.conf
CAUTION: After changing the
pg_hba.conf file
, use the commandpg_ctl reload
in the command line to apply the changed configuration! After changing the entrylisten_addresses
in thepostgresql.conf
, restart the database.
Initialization of a PostgreSQL® DB Cluster
For some Windows versions this error might be shown: "The database cluster initialization failed" and when executing the "create_database_windows.bat" file, the error "psql: error: could not connect to server: Connection refused (0x0000274D/10061)".
- In this case, add the path C:\Windows\system32 to the environment variable PATH.
Access to a Directory Denied
When running PostgreSQL® on Windows Server and executing the create_database_windows.bat
, a "Permission Denied" error may be shown when PostgreSQL® tries to
access directories.
You can solve this problem as follows:
- Otherwise the script would run under the account "Network Services", which does not have any rights on a Windows server to interact with such directories.
Multiple Versions of PostgreSQL®
If you have multiple versions of PostgreSQL®, note that the installation order impacts the order of the versions. The environment variables must contain the path to the wincc_oa_dir/bin/pgsql directory to make sure that the right version PostgreSQL® V16) is used.
To check the client version, use the following command in the command prompt:
psql --version
For the server version call the SQL query:
SELECT version();