Quote:
Turns out exactly the same thing happens with postgresql

Is $Hostname localhost? in other words, is there an underlying TCP connect going on? If it's non-local, check your DNS is working, use netstat -anp on the server to check the daemon is listening on the port you think it is, and try telnet to that hostname/port from the client to see if the connect succeeds, i.e. if there's any TCP/IP reason why it can't connect to the server. If it is localhost, check whether there's a Unix-domain socket or named pipe that you need to create, and check its permissions.

Peter