Postgresql – pgAgent : how to configure pgpass.conf for a local connection on Windows Server 2008

pgadminpostgresqlwindows-server

I try to configure pgAgent on Windows server 2008 to make automatic backup on the database.
pgAgent is installed on the server and the service is running normally.
I use PgAdmin3 and PostgreSql 9.3

I have already planned query using the connection string with the password in it, and it works perfectly.

Now, I try to make it by specifying the password in pgpass.conf (as said in the doc) but I always got the "Couldn't get a connection to the database !" error.

My pgpass.conf is something like this :

175.35.105.15:5432:*:admin:***
175.35.105.15:5432:*:postgres:***
localhost:5432:*:postgres:***
localhost:5432:*:admin:***
127.0.0.1:5432:*:admin:***

I know that some line are rhetorical, it's just that I've tried a lot of things.

I usually try to connect on localhost, but even in remote connection mode it doesn't work.

Here some examples of what I've tried with remote connection in step configuration :

user=admin host=175.35.105.15 port=5432 dbname=db
user=postgres host=175.35.105.15 port=5432 dbname=db
user=admin host=127.0.0.1 port=5432 dbname=db
user=postgres host=127.0.0.1 port=5432 dbname=db

EDIT : in Postgres log, pgagent is connected as adminpostgres. This username isn't in the login role…

pgpass.conf is in c:/user/Application Data/postgresql

pgAgent was installed with StackBuilder as Admin

I've tried to fill the "host agent" field with the content of "pga_jobagent.jagstation" but it doesn't work either

Best Answer

I've found it !

In Windows Service, i found that it was "adminpostgres" who was running the pgAgent service.

I just had to edit the pgpass.conf in c:/user/adminpostgres/AppData/postgresql with my old config to make it works !