node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

Connection example using /var/run/postgres

Open fergusg opened this issue 15 years ago • 1 comments

I can connect with "tcp://username:password@localhost/cdbname" but I'd rather use /var/run/postgres (unless there's another way to avoid supplying a password). However:

var pg = require('pg').native;
var client = new pg.Client("/var/run/postgres");
client.connect();

throws:

Error: Need to use node to do async DNS on host
    at /usr/local/lib/node/.npm/pg/0.4.0/package/lib/native.js:29:15
    at Connection.connect (/usr/local/lib/node/.npm/pg/0.4.0/package/lib/native.js:43:3)

Any suggestions?

fergusg avatar Apr 30 '11 18:04 fergusg

It was a typo /var/run/postgresQL - the error message threw me.

fergusg avatar Apr 30 '11 21:04 fergusg