xsharp.eu • PostgreSQL connect from client PC
Page 1 of 1

PostgreSQL connect from client PC

Posted: Wed Mar 25, 2020 10:23 am
by Juraj
Hi All,

I am testing a new app using PostgreSQL. Everything works OK on the local PC. If I want to connect from a client PC, I have a problem to connect to PostgreSQL Server. The server PC with Windows 7 Ultimate 64b., The client PC with Windows 10 Pro 64b. Can anyone help?

Juraj

PostgreSQL connect from client PC

Posted: Wed Mar 25, 2020 10:38 am
by FFF
hsc wrote:I am testing a new app using PostgreSQL. Everything works OK on the local PC. If I want to connect from a client PC, I have a problem to connect to PostgreSQL Server. The server PC with Windows 7 Ultimate 64b., The client PC with Windows 10 Pro 64b. Can anyone help?
Probably not - too less information available.
Can you connect using psql or similiar tool to the db at the server at all? What did you write in the postgres.conf re allowed access sources?

PostgreSQL connect from client PC

Posted: Wed Mar 25, 2020 10:51 am
by Juraj
I insert to pg_hba.conf this line
host all all 192.168.0.127/24 md5

in postressql.conf
listen_addresses = '*'

I check connet from client PC with Postgres ODBC

PostgreSQL connect from client PC

Posted: Wed Mar 25, 2020 11:21 am
by wriedmann
Hi Juraj,
IMHO

Code: Select all

host all all 192.168.0.127/24 md5
should be

Code: Select all

host all all 192.168.0.1/24 md5
Do you have restarted the Postgres server process after the changes?
If your host is a Windows machine, you need also to open the firewall on the port 5432.
Wolfgang

PostgreSQL connect from client PC

Posted: Wed Mar 25, 2020 12:49 pm
by Juraj
Hi Wolfgang,

I open the firewall on the port 5432 on client PC. When I open the firewall on the port 5432 on server PC, connection is OK.
Thank you very much!

Juraj

PostgreSQL connect from client PC

Posted: Wed Mar 25, 2020 1:16 pm
by wriedmann
Hi Juraj,
normally the Windows Firewall is configured to permit all exiting connections (otherwise you would have to open every single port for every client machine).
Incoming connections are normally all blocked - if you have some service that needs to be reachable from other machines you have to add a rule by hand.
Normally the installation process could open the port, but IMHO it is better to not do that, and to let this work to the administrator.
Wolfgang