ogr2ogr error: "Unable to initialize connection to the server ...."

439 Views Asked by At

I am getting the error detailed in the screenshot below when running ogr2ogr. The command used worked on my other computer. I am wondering if this is an error that is triggering because I do not have proper permissions.

OGR2OGR error connecting to databes

One last detail: the database I am uploading to exists.

1

There are 1 best solutions below

0
On

I just had this error and did the following until it worked.

  1. Mine was a fresh developer version installation on a new laptop. I needed to enable TCP/IP connection with SQL Server Configuration Manager

  2. Check I can telnet localhost 1433. If screen goes blank it means you connected and it's working.

  3. I'd also idiotically got the SA password wrong. It was still telling me that it could not create the database although it was just wrong password. I logged into SQL server with Windows Authentication and reset the SA password to the one I was using the connection string.

  4. My command was:

    ogr2ogr -overwrite -progress -f MSSQLSpatial -s_srs epsg:27700 -t_srs epsg:4326 "MSSQL:driver=ODBC Driver 17 for SQL Server;SERVER=localhost;timeout=0;Database=importer;UID=xxx;PWD=xxx" opname_gb.gpkg -FieldTypeToString All -nln opname_gb