I have enabled postgis extension already and have imported 3 shapefiles through the qgis db manager. Problem is that now I still have 2 large files to import and leaving qgis importing the entire night was not able to do finish the import. This is why I would need ogr2ogr to work
When I try to use the following command
ogr2ogr -f PostgreSQL PG:"dbname='postgres' host='hostnamehere' port='5432' user='user' password=passwordhere" folders/file.shp -nlt MULTIPOLYGON
I simply get the following error:
Unable to open datasource `folders/file.shp' with the following drivers.
The file opens just fine on QGIS. Is my ogr2ogr command wrong?
Alternatively I also tried psql as I've seen here on this website using:
psql -h host=hosthere gis postgres -p 5432
But got met with this error
psql: could not translate host name "host=host.rds.amazonaws.com" to address: nodename nor servname provided, or not known
I then tried using dbeaver to import a file from a csv but I keep getting java.lang.NullPointerException and it just doesnt appear to match the fields, yet the file still opens fine on Excel
Is my Ogr2ogr wrong or is there a different thing I can try?
ogrinfo folders/file.shpshow? Have you tried to give an absolute path to shapefile? – user30184 Nov 03 '20 at 18:22host=(psql -h bd1....amazonaws.com ...). Then you may want to ensure that only you can connect to this host, not the entire world. For #3 you can specify the field names in the copy command. It might be worth reading the doc oncopyand to write the import statement by hand. – JGH Nov 03 '20 at 18:27