dk_nls
dk_nls

Reputation: 13

pgagent on windows - Couldn't get a connection to the database

Hi I need a little help to get pgagent running on a windows 2008 with postgres 9.2.1 (ipv4 & ipv6)

I'm logged into the server (remote desktop) and trying to run a job.

If i check the output from the job:

SELECT j.jobname, s.jstname, l.jslstart, l.jslduration, l.jsloutput
   FROM pgagent.pga_jobsteplog l
   JOIN pgagent.pga_jobstep s ON s.jstid = l.jsljstid
   JOIN pgagent.pga_job j ON j.jobid = s.jstjobid
  WHERE l.jslstart > 'now'::text::date
  ORDER BY j.jobname, s.jstname, l.jslstart DESC;

I get this in jsloutput = Couldn't get a connection to the database!

When using pgadminIII to look at the job:

Enabled = checked
Connection type = local
Database = cachedb
Connection string = (It's empty can't fill when using local connection type)
Kind = sql
(doesn't help to select remote connection and fill the connection string)

This is my pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             0.0.0.1/0            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Any idea what I'm missing??

Upvotes: 0

Views: 4408

Answers (1)

incognito
incognito

Reputation: 2351

On server locate the connections file C:\Users\[pgagent service username]\AppData\Roaming\postgresql\pgpass.conf and make sure that the connection string is there.

If you provided connection to the default postgres database while installing pgAgent then you won't be able to run jobs on other databases even if the user has access rights. At least in my experience I had to add connection strings for every database.

Upvotes: 1

Related Questions