[GRASS-user] Finding why postgres database cannot be opened

st_kiefer at web.de st_kiefer at web.de
Thu Nov 8 06:30:43 PST 2018


Hi Rich,
to connect the database tabel to your map you have to specify the postgres connection with v.db.connect as well:

v.db.connect map=stations driver=pg database="host=localhost,dbname=willamette-river-hg" table=<NameOfTheTable> key=<NameOfTheCatColumn>

Consider that the <NameOfTheTable> have to be different from the name of the mapset, i.e. must not be called "stations"!

Regards.

Stefan
 
> Rich Shepard <rshepard at appl-ecosys.com> hat am 8. November 2018 um 15:07 geschrieben:
> 
> 
> On Thu, 8 Nov 2018, st_kiefer at web.de wrote:
> 
> > if you use a postgres database (driver=pg) you have to specify the full
> > connection string to the database. You can see this in the manual for
> > db.connect (look for PostgreSQL):
> 
> Stefan,
> 
>    Each time I think that I have the path requirement differences between
> db.connect and v.db.connect understood there's aninstance when I mix them up
> unintentionally. I've changed the db.connect line in the script to use
> localhost rather than the absolute path.
> 
>    As I responded to Markus M, I don't know how to fix the absolute path
> returned by v.db.connect
> 
> > db.connect driver=pg database="host=localhost,dbname=willamette-river-hg"
> 
> > db.connect -p
> driver: pg
> database: host=localhost,dbname=willamette-river-hg
> schema: 
> group:
> 
> > v.db.connect -p map=stations
> Vector map <stations> is connected by:
> layer <1/stations> table <stations> in database
> </home/rshepard/data/grassdata/willamette_basin/willamette-river-hg> through
> driver <pg> with key <cat>
> 
>    Trying again:
> 
> > db.connect driver=pg database=$HOME/data/grassdata/willamette_basin/willamette-river-hg
> 
> > v.db.connect -p map=stations
> Vector map <stations> is connected by:
> layer <1/stations> table <stations> in database
> </home/rshepard/data/grassdata/willamette_basin/willamette-river-hg> through
> driver <pg> with key <cat>
> 
>    What am I still doing incorrectly with db.connect?
> 
> Thanks,
> 
> Rich
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list