[GRASS-user] connect to postgreSQL
Stanislav Bek
bks at centrum.cz
Sat Oct 4 15:35:14 EDT 2008
>> 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
More information about the grass-user
mailing list