Upload .SHP file to SQL Server?

RXR 121 Reputation points
2021-02-09T04:15:08.557+00:00

I have .shp files that I want to upload to SQL Server

I am trying to find an easy solution to uploading .shp file to SQL Server 2018. I tried OGR2OGR and I get an error. Below is my OGR2OGR command and then the error.

ogr2ogr -progress -f "MSSQLSpatial" "MSSQL:server=xyz.database.windows.net;driver=SQL SERVER;database=Spatia;UID=test;PWD=test;trusted_connection=yes;" "C:\Users\AX\Desktop\SFTP Keys\spatial\aus_16_mb.shp" -a_srs "EPSG:4326"

ERROR 1: Unable to initialize connection to the server for MSSQL:server=xyz.database.windows.net;Database=Spatial;trusted_connection=yes,

Try specifying the driver in the connection string from the list of available drivers:
SQL Server
SQL Server Native Client 11.0
SQL Server Native Client RDA 11.0
ODBC Driver 13 for SQL Server
PostgreSQL ANSI(x64)
PostgreSQL Unicode(x64)
Amazon Redshift (x64)
ODBC Driver 17 for SQL Server

ERROR 1: MSSQL Spatial driver doesn't currently support database creation.
Please create database with the Microsoft SQL Server Client Tools.
ERROR 1: MSSQLSpatial driver failed to create MSSQL:server=xyz.database.windows.net;Database=Spatial;trusted_connection=yes

5vQWv9m

Azure Spatial Anchors
Azure Spatial Anchors
An Azure service that is used to build immersive three-dimensional applications and experiences that map, persist, and restore content or points of interest at real-world scale.
87 questions
Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,757 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 40,901 Reputation points
    2021-02-09T06:43:31.877+00:00

    ERROR 1: Unable to initialize connection to the server for MSSQL:server=xyz.database.windows.net;Database=Spatial;trusted_connection=yes,

    So you have a SQL Azure database?
    trusted_connection=yes means Windows authentication, that's not supported for SQL Azure; remove that parameter or set it to "no".

    1 person found this answer helpful.
    0 comments No comments