[GRASS-user] Grass 7 and postgresql

Nikos Alexandris nik at nikosalexandris.net
Fri Sep 2 09:48:34 PDT 2016


Benoit ANDRE wrote:

>> Moritz,
>>
>> First, I move from 6 to 7 with /v.build/ or /v.build.all/ (depends on
>> locations)
>>
>> Here, connections are already gone...
>>
>> I connect with :
>> /db.connect driver=pg database="host=192.168.1.200,dbname=administration"/
>>
>> /db.connect -p/ :
>> driver: pg
>> database: host=192.168.1.200,dbname=administration
>> schema: public
>> group:
>>
>> /db.login --overwrite user=benoit/
>> ATTENTION: DB connection <pg/host=192.168.1.200,dbname=administration>
>>            already exists and will be overwritten
>>
>>
>> When I try a /db.tables -p/, I get :
>> DBMI-PostgreSQL erreur de pilote :
>> Connection failed.
>> n'a pas pu se connecter au serveur : Aucun fichier ou dossier de ce type
>>     Le serveur est-il actif localement et accepte-t-il les connexions sur la
>>      socket Unix « /var/run/postgresql/.s.PGSQL.5432 » ?
>>
>>
>> DBMI-PostgreSQL erreur de pilote :
>> Connection failed.
>> n'a pas pu se connecter au serveur : Aucun fichier ou dossier de ce type
>>     Le serveur est-il actif localement et accepte-t-il les connexions sur la
>>      socket Unix « /var/run/postgresql/.s.PGSQL.5432 » ?
>>
>>
>> ERREUR :Unable to open database <host=192.168.1.200,dbname=administration>
>>
>>
>> /v.db.connect/ (dialog box) isn't usable, because the field 'Name of
>> attribute table' is empty...
>>
>> Il I try : /v.db.connect -o map=survey_bcg at benoit table=survey_bcg
>> key=cat layer=1/ (for facility, table name is the same as map name),
>> result is
>> DBMI-PostgreSQL erreur de pilote :
>> Connection failed.
>> n'a pas pu se connecter au serveur : Aucun fichier ou dossier de ce type
>>     Le serveur est-il actif localement et accepte-t-il les connexions sur la
>>      socket Unix « /var/run/postgresql/.s.PGSQL.5432 » ?
>>
>>
>> DBMI-PostgreSQL erreur de pilote :
>> Connection failed.
>> n'a pas pu se connecter au serveur : Aucun fichier ou dossier de ce type
>>     Le serveur est-il actif localement et accepte-t-il les connexions sur la
>>      socket Unix « /var/run/postgresql/.s.PGSQL.5432 » ?
>>
>>
>> ATTENTION: Impossible d'ouvrir la base de données
>>            <host=192.168.1.200,dbname=administration> avec le driver <pg>
>> ATTENTION: Impossible d'ouvrir la base de données
>>            <host=192.168.1.200,dbname=administration> avec le driver <pg>
>> ERREUR :La table <survey_bcg7> n'existe pas dans la base de données
>>
>> ***********************
>>
>> On my computer (192.168.1.11) :  psql -V is psql (PostgreSQL) 9.2.8
>> The server (192.168.1.200) : psql -V is psql (PostgreSQL) 9.2.15
>>
>>
>> All the other programs using postresql, including grass 6.4.4 work fine

Moritz Lennert:

>Weird.
>
>I tried to reproduce using the GRASS 6 data subset [1]:
>
>grass64 -c /data/GRASS/DATA/nc_basic_spm/gisdemo_ncspm/pg
>db.connect driver=pg database="host=127.0.0.1,dbname=testgrass"
>db.login user=mlennert
>for map in $(g.mlist type=vect pat="*" mapset=PERMANENT); do g.copy
>vect=$map,${map}_pg; done
>
>grass70 /data/GRASS/DATA/nc_basic_spm/gisdemo_ncspm/pg
>v.build.all
>
>All database connections are still there and I can connect to the
>database without any problems.
>
>So, I don't understand why all your database connections were lost after
>v.build/v.build.all.
>
>Martin, any idea ?
>
>[1] https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm.tar.gz

I cannot connect via grass73 into a postgres data base (one that I can
access via QGIS or else via psql through the command line):

GRASS 7.3.svn (wgs84):~ > db.login driver=pg database='****' user=***** password='**********' port=5432 host=localhost --o
WARNING: DB connection <pg/****> already exists and will be overwritten
The password was stored in file (/home/nik/.grass7/dblogin)

GRASS 7.3.svn (wgs84):~ > db.tables -p
DBMI-PostgreSQL driver error:
Connection failed.
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?


DBMI-PostgreSQL driver error:
Connection failed.
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?


ERROR: Unable to open database <host=localhost,dbname=****>

Nikos


More information about the grass-user mailing list