PostgreSQL connect from client PC

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Juraj
Posts: 161
Joined: Mon Jan 09, 2017 7:00 am

PostgreSQL connect from client PC

Post 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
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

PostgreSQL connect from client PC

Post 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?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Juraj
Posts: 161
Joined: Mon Jan 09, 2017 7:00 am

PostgreSQL connect from client PC

Post 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
Attachments
PSGODBC.png
PSGODBC.png (27.48 KiB) Viewed 625 times
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

PostgreSQL connect from client PC

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Juraj
Posts: 161
Joined: Mon Jan 09, 2017 7:00 am

PostgreSQL connect from client PC

Post 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
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

PostgreSQL connect from client PC

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply