[GRASS-user] Migrating to new RDBMS

Rich Shepard rshepard at appl-ecosys.com
Wed Oct 31 07:56:11 PDT 2018

On Wed, 31 Oct 2018, Moritz Lennert wrote:

> You database seems to be called 'willamette-river-hg', i.e. all hyphens,
> whereas you are trying to db.copy to 'willamette_river_hg', i.e. one
> hyphen, one underscore.


   Thank you. I use hyphens in multi-word file names while applications such
as grass and R use underscores. When I get them mixed up I have a tendency
to not see the discrepancy which is obvious to others.

   Now I need to fix an issue with db.connect. Perhaps others will see what
I'm overlooking.

> db.connect -p
driver: pg
database: willamette-river-hg

   Which suggests that grass sees the database. But, when I try to copy a
table from sqlite to pg the application fails to find the database:

The script:
db.connect driver=pg database="willamette-river-hg"
db.login driver=pg database="willamette-river-hg" host='salmo' port=5432 --o

db.copy from_driver=sqlite from_database="$HOME/data/grassdata/willamette_basin/mercury/sqlite/sqlite.db" from_table=all_species to_driver=pg to_database=willamette-river-hg to_table=all_species_pg

The result:
> $HOME/documents/white-papers/geochemistry/willamette-river-mercury/scripts/grass-to-postgres.sh
WARNING: DB connection <pg/willamette-river-hg> already exists and will be
DBMI-PostgreSQL driver error:
Connection failed.
could not connect to server: Connection refused
 	Is the server running on host "salmo" ( and accepting
 	TCP/IP connections on port 5432?

Contents of ~/.pgpass:
Replacing localhost with salmo makes no difference.

Best regards,


More information about the grass-user mailing list