pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Problem with pg_service.conf
Date: Wed, 22 Jul 2020 10:59:06 -0500
Message-ID: <8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com> (raw)
In-Reply-To: <eaf78330-ed9f-b267-834f-15a7e9f0258b@poczta.onet.pl>
References: <eaf78330-ed9f-b267-834f-15a7e9f0258b@poczta.onet.pl>

On 7/21/20 4:35 PM, MichaƂ Lis wrote:
> Hello,
>
> I can't connect to a database via service defined in pg_service.conf file 
> from remote machine.
>
> Connection from local machine using this service definition works fine.
>
> I tested it on PostgreSQL 9.4 and 9.6. The other problem is with the 
> localization of the pg_service.conf file.
>
> Reading internet solutions, I found, that this file may be placed in 
> global configuration folder.
>
> In my case it is D:\PostgreSQLx86\9.6\etc (the SYSCONFDIR variable 
> displayed by pg_config.exe).
>
> Placing the file into this folder does not work. I had to define the 
> global system variable PGSERVICEFILE = 
> D:\PostgreSQLx86\9.6\etc\pg_service.conf.
>
> After that the connection to database via service began work, but only on 
> local machine.
>
> To reproduce problem:
>
> 1. Create pg_service.conf file like this:
>
> [test4]
> host=192.168.1.2
> port=5433
> dbname=test
> user=postgres
> password=abcd
>
> 2. Save this file in a directory, in my case it was
> D:\PostgreSQLx86\9.6\etc\pg_service.conf
> (line ends in Linux style by NotePad++)
>
> 3. Set the global system variable:
> PGSERVICEFILE =D:\PostgreSQLx86\9.6\etc\pg_service.conf
>
> 4. Restart computer to take effects for setting PGSERVICEFILE

Are you sure that PGSERVICEFILE is being defined correctly?

>
> 5. Open PGAdmin 3 or 4 no matter which.
>
> 6. Add and Set database connection
> - Name: test
> - Host: 192.168.1.2
> - Port: 0
> - Service: test4
> - User: <empty>
> - Password: <empty>
>
> On the local machine the connection will be established but on remote 
> machine the error:
>
> "Definition of service "test4" not found"
>
> will be raised
>
> Connection from remote machine to server by host, port, user and password 
> works fine.
>
> PostgreSQL version: 9.6.11 and 9.4
> Operating system: Windows 7 x64 Pro/Ultimate
>
> Regards
> Michal
>
>
>
>
>

-- 
Angular momentum makes the world go 'round.





view thread (5+ messages)  latest in thread

Message-ID: <8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com>
Permalink:  ../8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com/
Also on:    postgresql.org/message-id/8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Problem with pg_service.conf
  In-Reply-To: <8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com>
  References: <eaf78330-ed9f-b267-834f-15a7e9f0258b@poczta.onet.pl> <8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox