Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyH9M-0001We-Ly for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 15:59:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jyH9K-0001I7-BZ for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 15:59:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyH9J-0001Hy-Sp for pgsql-general@lists.postgresql.org; Wed, 22 Jul 2020 15:59:17 +0000 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jyH9C-00017z-RM for pgsql-general@lists.postgresql.org; Wed, 22 Jul 2020 15:59:16 +0000 Received: by mail-ot1-x342.google.com with SMTP id 5so2103823oty.11 for ; Wed, 22 Jul 2020 08:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=xgIWTg+8uELMyKeQ0S0eE6oBe4Y49hxB+UX5rk/BvWU=; b=UW9fFzoNAmQT7TEv6aCHiVBQfJJC4o+ImzJ455xXCLOwhtgev5X/hnnUC1OWEZmO94 QwbriytBRrDzbF5/jAUOnaTnEUnJYSQ30/vFo3z66QxqXez70Qd1YbOBWXrzSw6rVAso /Yg5Y+A7OuKOWRqI2Oajm2UPTMd6dsXtA4WABdBrTfzzNoYMdIWMARBHgTdlgNsAmld4 eMh41JuZimmAK6kZHGCplg4neTBJ/KAFWW6fItf5Oy4CbMeEXzu7RxYzywGcoXnxs36w AL5qpMVGCqfSoa9PQZpl7DgTcduMifbHoysFBgoDeGWGUPpOFn2aGmUvzje9hJ7KhZUz rYaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=xgIWTg+8uELMyKeQ0S0eE6oBe4Y49hxB+UX5rk/BvWU=; b=Of8t8MUJI1DNWID7syBqP56kN2pMVzB+DLLjh9LDv7AJZn0G4NMGKoeKFFjZG/mdgM +LgvJZniWnJ+/ecPe5QA7h2pO+HnJK94xM9Ise3+geJx89AFVqHQPQrmvUQRnSEO0wzl EgH0WpTD+7XrAmjypSmJLY6rdbT2DLxjLL74C6jBwM23b17Q0Eu7PpsrolFMaYMhHvf5 t9zzrfsqvoAI4oaiR3jZGL8qVyfQkUfSj12rZJSIalwIOaJaMVqHRSQYBHcY+OKt2vZk Z/UhnjZB662e+7X6IC+Glg3M8uJhQAjk25KJn5RZyWtBJFLGwcjsh831XIstFkH/oMGZ GRRA== X-Gm-Message-State: AOAM532dHQCL3k/7G/4z8f4tcJ1/SyUfRUhrJ7LMezeSW1kBsbEsMCDC Di0n5LBDAJ3eDhYeLcJinapZHVWon0UGSw== X-Google-Smtp-Source: ABdhPJy0fTyeGoePz174m1GgW5I6qFbOBlmwl3rObFtkDBToJD25U4gEkSqCX0xvTlbJ3F9VdYyeDA== X-Received: by 2002:a9d:889:: with SMTP id 9mr547134otf.307.1595433549520; Wed, 22 Jul 2020 08:59:09 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id w13sm43403otq.14.2020.07.22.08.59.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jul 2020 08:59:08 -0700 (PDT) Subject: Re: Problem with pg_service.conf To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <8e30b347-df13-5880-bd9f-05e7c0630c6d@gmail.com> Date: Wed, 22 Jul 2020 10:59:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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: > - Password: > > 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.