[GRASS-user] connect to postgreSQL

Glynn Clements glynn at gclements.plus.com
Thu Oct 16 13:26:11 EDT 2008


Stanislav Bek wrote:

> >> Cannot connect to Postgres: could not connect to server: No such file or directory
> >> 	Is the server running locally and accepting
> >> 	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

> >	db.connect driver=pg database="host=localhost,dbname=gis1"
> 
> With this, it does not work yet.

Okay; it may not be listening for TCP connections, but even if it is,
the client is probably using the wrong port; see below.

> So I've done:
> 
> GRASS 6.3.0 (opava):~/skripty > netstat -ax| grep post
> unix  2      [ ACC ]     STREAM     LISTENING     13460    /var/run/postgresql/.s.PGSQL.5433

Note: the error message says .5432 (which is the default), but netstat
says .5433.

Try:
	export PGPORT=5433

in the GRASS shell.

The port can be set in the config file, but also via:

       -p port
	      Specifies	 the  TCP/IP  port  or	local  Unix domain socket file
	      extension on which the postmaster is to listen  for  connections
	      from  client  applications.  Defaults to the value of the PGPORT
	      environment variable, or if PGPORT is not set, then defaults  to
	      the value established during compilation (normally 5432). If you
	      specify a port other than the  default  port,  then  all	client
	      applications  must  specify  the same port using either command-
	      line options or PGPORT.

If it's set in the config file, clients should pick it up
automatically. But if it's set via -p or $PGPORT, you'll need to set
PGPORT to convey the port to clients.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list