PostgreSQL Database

<< Click to Display Table of Contents >>

Navigation:  Databases >

PostgreSQL Database

Previous pageReturn to chapter overviewNext page

To work with PostgreSQL databases you have to install PostgreSQL server on your PC. How to install server you can find in the Internet. For example here. To setup firewall use this command in command line (should be started under Administrator rights):

netsh advfirewall firewall add rule name="Postgre Port" dir=in action=allow protocol=TCP localport=5432

 

Settings required for getting exception in English

If you are getting exceptions with not readable symbols (actual for users who doesn't use english language) you have to find file postgresql.conf in the directory where install PosgreSQL server. Find property lc_messages and change it into 'en-En.utf-8'. Save the file and restart postgresql service (you can find it task manager ->Services tab).

 

Settings required for connecting to a remote database

In order to remotely access a PostgreSQL database, you should set the two main PostgreSQL configuration files:

postgresql.conf

pg_hba.conf

Here is a brief description how you can set them (note that the following description is purely indicative: To configure a machine safely, you should be familiar with all the parameters and their meanings). First of all, configure PostgreSQL service to listen on port 5432 on all network interfaces in Windows machine:

open the file postgresql.conf (usually located in C:\Program Files\PostgreSQL\{your version}\data) and sets the parameter

listen_addresses = '*' (if it didn't setup)

Open and add in the pg_hba.conf file:

host    all             all              0.0.0.0/0                       md5

Save the files and restart postgresql service (you can find it in task manager ->Services tab).