I am using the following command to upload a geopackage into a POSTGIS database using the OSGeo4W shell that comes with QGIS.

ogr2ogr -f “PostgreSQL” PG:”host=<hostname>  dbname=<dbname> user=<yourusername> password=<yourpassword>” <dir>\geopackage.gpkg

I am following a guide online and know this is the command to use yet I am presented with the following error:

"FAILURE: Unable to open datasource `DATASOURCE' with the following drivers."

It then lists a bunch of file formats including the gpkg format.

Stumped for ideas on this one!

New contributor
stixcraven is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • what is your actual PG: string (leave out the actual password etc but we need to see the exact quoting
    – Ian Turton
    Sep 10 at 10:37
  • 1
    I see characters in your question but in gdal command line the characters must be ". If you copy-pasted your command then re-write it from the keyboard for getting the double quotes right.
    – user30184
    Sep 10 at 12:06
  • @IanTurton my string is: ogr2ogr -f PostgreSQL "PG:host= HOST PG:user=postgres password=PASSWORD dbname=Trafford_test" C:/Users/USER/Documents/Routes.gpkg
    – stixcraven
    Sep 10 at 12:56
  • @user30184 I have typed the command manually and that gives the same response
    – stixcraven
    Sep 10 at 12:58
  • Does ogrinfo C:/Users/USER/Documents/Routes.gpkg work? Does ogrinfo "PG:host= HOST user=postgres password=PASSWORD dbname=Trafford_test" work?
    – user30184
    Sep 10 at 13:52

Your Answer

stixcraven is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.