[GRASS-user] connect to postgreSQL

Hi,

I have problem to connect to postgreSQL server from grass.

GRASS 6.3.0 (opava):~ > psql -l
        List of databases
   Name | Owner | Encoding
-----------+----------+----------
gis1 | bekas | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(4 rows)

GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1

GRASS 6.3.0 (opava):~ > db.test test=test1
create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
DBMI-Postgres driver error:
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"?

ERROR: Unable to open database <gis1>
ERROR: EXECUTE: ******** ERROR ********

etc.

I use PostgreSQL 8.3.3.

Don't you have an idea why it is not working?

Best regards,
Stanislav

On 04/10/08 16:39, Stanislav Bek wrote:

Hi,

I have problem to connect to postgreSQL server from grass.

GRASS 6.3.0 (opava):~ > psql -l
        List of databases
   Name | Owner | Encoding -----------+----------+----------
gis1 | bekas | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(4 rows)

GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1

GRASS 6.3.0 (opava):~ > db.test test=test1
create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
DBMI-Postgres driver error:
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"?

ERROR: Unable to open database <gis1>
ERROR: EXECUTE: ******** ERROR ********

etc.

I use PostgreSQL 8.3.3.

Don't you have an idea why it is not working?

The error message is quite clear:

"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"?"

This is a PostgreSQL issue (you will probably get the same message if you try to connect with 'psql -h localhost gis1').

This means that PostgreSQL is not installed to accept connections via tcp/. You can change that in the relevant config file (probably something like /etc/postgresql/8.3/main/postgresql.conf - but that depends on your distribution).

Moritz

On 04/10/08 16:39, Stanislav Bek wrote:

Hi,

I have problem to connect to postgreSQL server from grass.

GRASS 6.3.0 (opava):~> psql -l
        List of databases
   Name | Owner | Encoding
-----------+----------+----------
gis1 | bekas | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(4 rows)

GRASS 6.3.0 (opava):~> db.connect driver=pg database=gis1

GRASS 6.3.0 (opava):~> db.test test=test1
create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
DBMI-Postgres driver error:
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"?

in the error said, the server is running locally..

Try

GRASS 6.3.0 (opava):~> db.connect driver=pg database="host=localhost,dbname=gis1"
db.login user=your user pass=your password
db.connect -p
db.tables -p

if not is connection posible. follow you the advice Moritz

John

ERROR: Unable to open database
ERROR: EXECUTE: ******** ERROR ********

etc.

I use PostgreSQL 8.3.3.

Don't you have an idea why it is not working?

The error message is quite clear:

"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"?"

This is a PostgreSQL issue (you will probably get the same message if
you try to connect with 'psql -h localhost gis1').

This means that PostgreSQL is not installed to accept connections via
tcp/. You can change that in the relevant config file (probably
something like /etc/postgresql/8.3/main/postgresql.conf - but that
depends on your distribution).

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

_________________________________________________________________
¡Entra en el Club oficial de Messenger y te enterarás de todas las novedades!
http://www.vivelive.com/ilovemessenger

Hi,
> I have problem to connect to postgreSQL server from grass.
> GRASS 6.3.0 (opava):~ > psql -l
        List of databases
   Name | Owner | Encoding > -----------+----------+----------
gis1 | bekas | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(4 rows)
> GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1 > > GRASS 6.3.0 (opava):~ > db.test test=test1
create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
DBMI-Postgres driver error:
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"?
> > ERROR: Unable to open database <gis1>
ERROR: EXECUTE: ******** ERROR ********
> etc.
> I use PostgreSQL 8.3.3.
> Don't you have an idea why it is not working?

The error message is quite clear:

"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"?"

This is a PostgreSQL issue (you will probably get the same message if you try to connect with 'psql -h localhost gis1').

'psql -h localhost gis1' works, I enter psql environment with this.

This means that PostgreSQL is not installed to accept connections via tcp/. You can change that in the relevant config file (probably something like /etc/postgresql/8.3/main/postgresql.conf - but that depends on your distribution).

I' ve tried to change some items but without success. (I am using Ubuntu Hardy Heron.)
I am sending the important part of the postgresql.conf file:
Thank you very much for your help.

#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------

# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/8.3/main' # use data in another directory
          # (change requires restart)
hba_file = '/etc/postgresql/8.3/main/pg_hba.conf' # host-based authentication file
          # (change requires restart)
ident_file = '/etc/postgresql/8.3/main/pg_ident.conf' # ident configuration file
          # (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/8.3-main.pid' # write an extra PID file
          # (change requires restart)

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

#listen_addresses = 'localhost' # what IP address(es) to listen on;
          # comma-separated list of addresses;
          # defaults to 'localhost', '*' = all
          # (change requires restart)
port = 5433 # (change requires restart)
max_connections = 100 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You might
# also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directory = '/var/run/postgresql' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
          # (change requires restart)
#bonjour_name = '' # defaults to the computer name
          # (change requires restart)

# - Security and Authentication -

#authentication_timeout = 1min # 1s-600s
ssl = true # (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
          # (change requires restart)
#password_encryption = on
#db_user_namespace = off

# Kerberos and GSSAPI
#krb_server_keyfile = '' # (change requires restart)
#krb_srvname = 'postgres' # (change requires restart, Kerberos only)
#krb_server_hostname = '' # empty string matches any keytab entry
          # (change requires restart, Kerberos only)
#krb_caseins_users = off # (change requires restart)
#krb_realm = '' # (change requires restart)

# - TCP Keepalives -
# see "man 7 tcp" for details

#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
          # 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
          # 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
          # 0 selects the system default

Perhaps : check and adjust the port in the .conf file.

Value in your .conf is port = 5433,

but message says no connection on Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432 ?

or try uncommenting the line

#listen_addresses = ‘localhost’

in the .conf file

Le samedi 04 octobre 2008 à 21:35 +0200, Stanislav Bek a écrit :

>> Hi,
>> > I have problem to connect to postgreSQL server from grass.
>> > GRASS 6.3.0 (opava):~ > psql -l
>>         List of databases
>>    Name    |  Owner   | Encoding > -----------+----------+----------
>>  gis1      | bekas    | UTF8
>>  postgres  | postgres | UTF8
>>  template0 | postgres | UTF8
>>  template1 | postgres | UTF8
>> (4 rows)
>> > GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1 > > GRASS 6.3.0 (opava):~ > db.test test=test1
>> create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
>> DBMI-Postgres driver error:
>> 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"?
>> > > ERROR: Unable to open database <gis1>
>> ERROR: EXECUTE: ******** ERROR ********
>> > etc.
>> > I use PostgreSQL 8.3.3.
>> > Don't you have an idea why it is not working?
>
>The error message is quite clear:
>
>"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"?"
>
>This is a PostgreSQL issue (you will probably get the same message if you try to connect with 'psql -h localhost gis1').

'psql -h localhost gis1' works, I enter psql environment with this.

>
>This means that PostgreSQL is not installed to accept connections via tcp/. You can change that in the relevant config file (probably something like /etc/postgresql/8.3/main/postgresql.conf - but that depends on your distribution).

I' ve tried to change some items but without success. (I am using Ubuntu Hardy Heron.)
I am sending the important part of the postgresql.conf file:
Thank you very much for your help.

#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------

# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/8.3/main'		# use data in another directory
					# (change requires restart)
hba_file = '/etc/postgresql/8.3/main/pg_hba.conf'	# host-based authentication file
					# (change requires restart)
ident_file = '/etc/postgresql/8.3/main/pg_ident.conf'	# ident configuration file
					# (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/8.3-main.pid'		# write an extra PID file
					# (change requires restart)

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

#listen_addresses = 'localhost'		# what IP address(es) to listen on;
					# comma-separated list of addresses;
					# defaults to 'localhost', '*' = all
					# (change requires restart)
port = 5433				# (change requires restart)
max_connections = 100			# (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
# connection slot, plus lock space (see max_locks_per_transaction).  You might
# also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 3	# (change requires restart)
unix_socket_directory = '/var/run/postgresql'		# (change requires restart)
#unix_socket_group = ''			# (change requires restart)
#unix_socket_permissions = 0777		# begin with 0 to use octal notation
					# (change requires restart)
#bonjour_name = ''			# defaults to the computer name
					# (change requires restart)

# - Security and Authentication -

#authentication_timeout = 1min		# 1s-600s
ssl = true				# (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'	# allowed SSL ciphers
					# (change requires restart)
#password_encryption = on
#db_user_namespace = off

# Kerberos and GSSAPI
#krb_server_keyfile = ''		# (change requires restart)
#krb_srvname = 'postgres'		# (change requires restart, Kerberos only)
#krb_server_hostname = ''		# empty string matches any keytab entry
					# (change requires restart, Kerberos only)
#krb_caseins_users = off		# (change requires restart)
#krb_realm = ''           		# (change requires restart)

# - TCP Keepalives -
# see "man 7 tcp" for details

#tcp_keepalives_idle = 0		# TCP_KEEPIDLE, in seconds;
					# 0 selects the system default
#tcp_keepalives_interval = 0		# TCP_KEEPINTVL, in seconds;
					# 0 selects the system default
#tcp_keepalives_count = 0		# TCP_KEEPCNT;
					# 0 selects the system default

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

Benoit ANDRE
Géologue - Hydrologue


Bureau Conseil en Géologie
Rue de Leuze, 433
B-5300 VEZIN
BELGIQUE

Tél.: +32 81 58 26 11
Fax.: +32 81 58 26 12
Contacter…
Bureau Conseil en Géologie


Stanislav Bek wrote:

I have problem to connect to postgreSQL server from grass.

GRASS 6.3.0 (opava):~ > psql -l
        List of databases
   Name | Owner | Encoding
-----------+----------+----------
gis1 | bekas | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(4 rows)

GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1

GRASS 6.3.0 (opava):~ > db.test test=test1
create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
DBMI-Postgres driver error:
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"?

Try:

  db.connect driver=pg database="host=localhost,dbname=gis1"

to connect using TCP.

Also, "netstat -ax" will list active Unix-domain sockets. If
postmaster is accepting local (Unix-domain) connections, its socket
will be listed there. E.g. I have:

unix 2 [ ACC ] STREAM LISTENING 3442 /tmp/.s.PGSQL.5432

If it's listening on a Unix-domain socket, check that you have the
necessary permissions on both the socket and its parent directories.

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

I have problem to connect to postgreSQL server from grass.

GRASS 6.3.0 (opava):~ > psql -l
        List of databases
   Name | Owner | Encoding
-----------+----------+----------
gis1 | bekas | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(4 rows)

GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1

GRASS 6.3.0 (opava):~ > db.test test=test1
create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
DBMI-Postgres driver error:
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"?

Try:

db.connect driver=pg database="host=localhost,dbname=gis1"

With this, it does not work yet.

to connect using TCP.

Also, "netstat -ax" will list active Unix-domain sockets. If
postmaster is accepting local (Unix-domain) connections, its socket
will be listed there. E.g. I have:

unix 2 [ ACC ] STREAM LISTENING 3442 /tmp/.s.PGSQL.5432

If it's listening on a Unix-domain socket, check that you have the
necessary permissions on both the socket and its parent directories.

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

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
sudo chmod 777 /var/run/postgresql/.s.PGSQL.5433
sudo chmod 777 /var/run/postgresql/

in postgresql.conf there is a line:
#unix_socket_permissions = 0777 # begin with 0 to use octal notation

After that: db.test test=test1 again without success.

Thank you very much for your help.
Best regards,
Stanislav

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@gclements.plus.com>

Try to uncomment the line (cut out the #)

#unix_socket_permissions = 0777 # begin with 0 to use octal notation

to make it active, but I don’t the problem is there

Or look at the socket : 5432 or 5433. The ‘normal’ socket of psql is 5432.

And also : in the first lines of postgresql.conf, there is a line like this (the adress is in my case) :

listen_addresses = ‘192.168.10.1’

Is this line uncomment (without the #) ? And what are the adresses ?

Benoit.

Le jeudi 16 octobre 2008 à 18:54 +0200, Stanislav Bek a écrit :

>> I have problem to connect to postgreSQL server from grass.
>> 
>> GRASS 6.3.0 (opava):~ > psql -l
>>         List of databases
>>    Name    |  Owner   | Encoding 
>> -----------+----------+----------
>>  gis1      | bekas    | UTF8
>>  postgres  | postgres | UTF8
>>  template0 | postgres | UTF8
>>  template1 | postgres | UTF8
>> (4 rows)
>> 
>> GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1 
>> 
>> GRASS 6.3.0 (opava):~ > db.test test=test1
>> create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
>> DBMI-Postgres driver error:
>> 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"?
>
>Try:
>
>	db.connect driver=pg database="host=localhost,dbname=gis1"

With this, it does not work yet.

>
>to connect using TCP.
>
>Also, "netstat -ax" will list active Unix-domain sockets. If
>postmaster is accepting local (Unix-domain) connections, its socket
>will be listed there. E.g. I have:
>
>unix  2      [ ACC ]     STREAM     LISTENING     3442     /tmp/.s.PGSQL.5432
>
>If it's listening on a Unix-domain socket, check that you have the
>necessary permissions on both the socket and its parent directories.
>
>-- 
>Glynn Clements <[glynn@gclements.plus.com](mailto:glynn@gclements.plus.com)>

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
sudo chmod 777  /var/run/postgresql/.s.PGSQL.5433
sudo chmod 777  /var/run/postgresql/

in postgresql.conf there is a line:
#unix_socket_permissions = 0777		# begin with 0 to use octal notation

After that:  db.test test=test1 again without success.

Thank you very much for your help.
Best regards,
Stanislav 

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

Benoit ANDRE
Géologue - Hydrologue


Bureau Conseil en Géologie
Rue de Leuze, 433
B-5300 VEZIN
BELGIQUE

Tél.: +32 81 58 26 11
Fax.: +32 81 58 26 12
Contacter…
Bureau Conseil en Géologie


I have uncommented a restarted the server, but db.test is again not OK.
socket is also 5433... ?

this is part of my .conf file:
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = 'localhost' # what IP address(es) to listen on;
          # comma-separated list of addresses;
          # defaults to 'localhost', '*' = all
          # (change requires restart)
port = 5433 # (change requires restart)
max_connections = 100 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You might
# also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directory = '/var/run/postgresql' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
unix_socket_permissions = 0777 # begin with 0 to use octal notation
          # (change requires restart)
#bonjour_name = '' # defaults to the computer name
          # (change requires restart)

______________________________________________________________

Od: benoit.andre@bcgeol.be
Komu: Stanislav Bek &lt;bks@centrum.cz&gt;

&gt; CC: glynn@gclements.plus.com, grass-user@lists.osgeo.org

Datum: 16.10.2008 19:29
Předmět: Re: [GRASS-user] connect to postgreSQL

Try to uncomment the line (cut out the #)

#unix_socket_permissions = 0777 # begin with 0 to use octal notation

to make it active, but I don't the problem is there

Or look at the socket : 5432 or 5433. The 'normal' socket of psql is
5432.

And also : in the first lines of postgresql.conf, there is a line like
this (the adress is in my case) :

listen_addresses = '192.168.10.1'

Is this line uncomment (without the #) ? And what are the adresses ?

Benoit.

Le jeudi 16 octobre 2008 à 18:54 +0200, Stanislav Bek a écrit :

>> I have problem to connect to postgreSQL server from grass.
>>
>> GRASS 6.3.0 (opava):~ > psql -l
>> List of databases
>> Name | Owner | Encoding
>> -----------+----------+----------
>> gis1 | bekas | UTF8
>> postgres | postgres | UTF8
>> template0 | postgres | UTF8
>> template1 | postgres | UTF8
>> (4 rows)
>>
>> GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1
>>
>> GRASS 6.3.0 (opava):~ > db.test test=test1
>> create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
>> DBMI-Postgres driver error:
>> 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"?
>
>Try:
>
> db.connect driver=pg database="host=localhost,dbname=gis1"

With this, it does not work yet.

>
>to connect using TCP.
>
>Also, "netstat -ax" will list active Unix-domain sockets. If
>postmaster is accepting local (Unix-domain) connections, its socket
>will be listed there. E.g. I have:
>
>unix 2 [ ACC ] STREAM LISTENING 3442 /tmp/.s.PGSQL.5432
>
>If it's listening on a Unix-domain socket, check that you have the
>necessary permissions on both the socket and its parent directories.
>
>--
>Glynn Clements <glynn@gclements.plus.com>

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
sudo chmod 777 /var/run/postgresql/.s.PGSQL.5433
sudo chmod 777 /var/run/postgresql/

in postgresql.conf there is a line:
#unix_socket_permissions = 0777 # begin with 0 to use octal notation

After that: db.test test=test1 again without success.

Thank you very much for your help.
Best regards,
Stanislav

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Benoit ANDRE
Géologue - Hydrologue

________________________________________________________________________

Bureau Conseil en Géologie
Rue de Leuze, 433
B-5300 VEZIN
BELGIQUE

Tél.: +32 81 58 26 11
Fax.: +32 81 58 26 12
Contacter...
Bureau Conseil en Géologie
________________________________________________________________________

What is the result of a

ps ax | grep pos

in an bash shell ?

Le jeudi 16 octobre 2008 à 20:38 +0200, Stanislav Bek a écrit :

I have uncommented a restarted the server, but db.test is again not OK.
socket is also 5433... ?

this is part of my .conf file:
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = 'localhost'		# what IP address(es) to listen on;
					# comma-separated list of addresses;
					# defaults to 'localhost', '*' = all
					# (change requires restart)
port = 5433				# (change requires restart)
max_connections = 100			# (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
# connection slot, plus lock space (see max_locks_per_transaction).  You might
# also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 3	# (change requires restart)
unix_socket_directory = '/var/run/postgresql'		# (change requires restart)
#unix_socket_group = ''			# (change requires restart)
unix_socket_permissions = 0777		# begin with 0 to use octal notation
					# (change requires restart)
#bonjour_name = ''			# defaults to the computer name
					# (change requires restart)

______________________________________________________________
> Od: [benoit.andre@bcgeol.be](mailto:benoit.andre@bcgeol.be)
> Komu: Stanislav Bek &lt;[bks@centrum.cz](mailto:bks@centrum.cz)&gt;
&gt; CC: [glynn@gclements.plus.com](mailto:glynn@gclements.plus.com), [grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
> Datum: 16.10.2008 19:29
> Předmět: Re: [GRASS-user] connect to postgreSQL
>
>Try to uncomment the line (cut out the #)
>
>#unix_socket_permissions = 0777		# begin with 0 to use octal notation
>
>to make it active, but I don't the problem is there
>
>Or look at the socket : 5432 or 5433.  The 'normal' socket of psql is
>5432.
>
>And also : in the first lines of postgresql.conf, there is a line like
>this (the adress is in my case) : 
>
>listen_addresses = '192.168.10.1'
>
>Is this line uncomment (without the #) ? And what are the adresses ?
>
>Benoit.
>
>Le jeudi 16 octobre 2008 à 18:54 +0200, Stanislav Bek a écrit :
>
>> >> I have problem to connect to postgreSQL server from grass.
>> >> 
>> >> GRASS 6.3.0 (opava):~ > psql -l
>> >>         List of databases
>> >>    Name    |  Owner   | Encoding 
>> >> -----------+----------+----------
>> >>  gis1      | bekas    | UTF8
>> >>  postgres  | postgres | UTF8
>> >>  template0 | postgres | UTF8
>> >>  template1 | postgres | UTF8
>> >> (4 rows)
>> >> 
>> >> GRASS 6.3.0 (opava):~ > db.connect driver=pg database=gis1 
>> >> 
>> >> GRASS 6.3.0 (opava):~ > db.test test=test1
>> >> create table grass_test1 (i1 integer, d1 double precision, c1 varchar(20))
>> >> DBMI-Postgres driver error:
>> >> 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"?
>> >
>> >Try:
>> >
>> >	db.connect driver=pg database="host=localhost,dbname=gis1"
>> 
>> With this, it does not work yet.
>> 
>> >
>> >to connect using TCP.
>> >
>> >Also, "netstat -ax" will list active Unix-domain sockets. If
>> >postmaster is accepting local (Unix-domain) connections, its socket
>> >will be listed there. E.g. I have:
>> >
>> >unix  2      [ ACC ]     STREAM     LISTENING     3442     /tmp/.s.PGSQL.5432
>> >
>> >If it's listening on a Unix-domain socket, check that you have the
>> >necessary permissions on both the socket and its parent directories.
>> >
>> >-- 
>> >Glynn Clements <[glynn@gclements.plus.com](mailto:glynn@gclements.plus.com)>
>> 
>> 
>> 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
>> sudo chmod 777  /var/run/postgresql/.s.PGSQL.5433
>> sudo chmod 777  /var/run/postgresql/
>> 
>> in postgresql.conf there is a line:
>> #unix_socket_permissions = 0777		# begin with 0 to use octal notation
>> 
>> After that:  db.test test=test1 again without success.
>> 
>> Thank you very much for your help.
>> Best regards,
>> Stanislav 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> grass-user mailing list
>> [grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
>> [http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)
>
>Benoit ANDRE
>Géologue - Hydrologue
>
>
>________________________________________________________________________
>
>
>
>
>
>Bureau Conseil en Géologie
>Rue de Leuze, 433
>B-5300 VEZIN
>BELGIQUE
>
>Tél.: +32 81 58 26 11
>Fax.: +32 81 58 26 12
>Contacter...
>Bureau Conseil en Géologie 
>________________________________________________________________________
>
>

Benoit ANDRE
Géologue - Hydrologue


Bureau Conseil en Géologie
Rue de Leuze, 433
B-5300 VEZIN
BELGIQUE

Tél.: +32 81 58 26 11
Fax.: +32 81 58 26 12
Contacter…
Bureau Conseil en Géologie