Sorry. Problem solved.It was the firewall on the postgresql server box.It gets updated daily and must somehow have led to this issue.
Apologies again for wasting space.