Re: Problem with pg_service.conf

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Problem with pg_service.conf
Дата
Msg-id dbbc9d48-b44b-8ecd-1543-a62e86f0eb77@aklaver.com
обсуждение исходный текст
Ответ на Problem with pg_service.conf  (Michał Lis <fcs1@poczta.onet.pl>)
Ответы Re: Problem with pg_service.conf  (Michał Lis <fcs1@poczta.onet.pl>)
Список pgsql-general
On 7/21/20 2: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
> 
> 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.

Where is the server located?

Are you on remote machine when you try to use the service file?

If so, that is not going to work as the remote machine will not have 
access to the local environment.


> 
> PostgreSQL version: 9.6.11 and 9.4
> Operating system: Windows 7 x64 Pro/Ultimate
> 
> Regards
> Michal
> 
> 
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



В списке pgsql-general по дате отправления:

Предыдущее
От: Samuel Nelson
Дата:
Сообщение: Re: CASCADE/fkey order
Следующее
От: Michał Lis
Дата:
Сообщение: Re: Problem with pg_service.conf