<div dir="ltr">Hi Pete -<div><br></div><div>Your first take on the commandstring probably contains an error...</div><div><br></div><div>ogr2ogr -f MSSQLSpatial "MSSQL:server=localhost;database=[database-name];username=sa;password=*****<b>;trusted_connection=yes</b>" [path-to-shape-file]<br> </div><div>You probably hasn't made the necessary setup with kerberos to use "integrated security" (the "<b>trusted_connection=yes</b>" part in the connection string)</div><div><br></div><div>This command might have worked ( no trusted_connection parameter):</div><div>ogr2ogr -f MSSQLSpatial "MSSQL:server=localhost;database=[database-name];username=sa;password=*****" [path-to-shape-file]<br></div><div><br></div><div>Your second take doesn't contain the "trusted_connection" part </div><div>ogr2ogr -f MSSQLSpatial "MSSQL:server=[server];database=[database];uid=[username];Pwd=[password];Driver={ODBC Driver 17 for SQL Server}" [shape file]<br></div><div><br></div><div><br></div><div><br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
--- Run ogr2ogr using driver<br>
ogr2ogr -f MSSQLSpatial "MSSQL:server=[server];database=[database];uid=[username];Pwd=[password];Driver={ODBC Driver 17 for SQL Server}" [shape file]<br>
<br>
<br>
Thanks,<br>
Pete<br>
<br>
-----Original Message-----<br>
From: gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>> On Behalf Of Mateusz Loskot<br>
Sent: 22 October 2018 16:31<br>
To: <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
Subject: Re: [gdal-dev] Import Shapefile into SQL Server on Ubuntu<br>
<br>
On Mon, 22 Oct 2018 at 17:25, Peter Marlow <<a href="mailto:Peter.Marlow@scisys.co.uk" target="_blank">Peter.Marlow@scisys.co.uk</a>> wrote:<br>
><br>
> I’m trying to import a Shapefile into an SQL Server database using ogr2ogr on Ubuntu. The command I’m running looks like:<br>
><br>
> ogr2ogr -f MSSQLSpatial <br>
> "MSSQL:server=localhost;database=[database-name];username=sa;password=<br>
> *****;trusted_connection=yes" [path-to-shape-file]<br>
><br>
> It returns an error stating:<br>
><br>
> ERROR 1: Unable to find driver `MSSQLSpatial'.<br>
<br>
I guess, GDAL/OGR version you are using on Linux is not built with ODBC/SQL Server support.<br>
<br>
> Is it possible to get the driver on linux? Or use an alternative driver? I’ve had a google and can’t seem to see any workarounds.<br>
><br>
> The docs here (<a href="https://www.gdal.org/drv_mssqlspatial.html" rel="noreferrer" target="_blank">https://www.gdal.org/drv_mssqlspatial.html</a>) talk about <br>
> specifying a Driver parameter that could be a custom SQL Server driver, however this is in the connection string and not as a parameter for the ogr2ogr command.<br>
<br>
Once you get GDAL/OGR built with SQL Server, install ODBC Driver for SQL Server (there are clear docs on Microsoft site, you will find easily searching the web)<br>
<br>
Then, try sticking the Driver option into the connection string Driver={ODBC Driver 11 for SQL Server} Driver={ODBC Driver 13 for SQL Server} Driver={ODBC Driver 13.1 for SQL Server} Driver={ODBC Driver 17 for SQL Server} depending which version you install.<br>
<br>
Best regards,<br>
--<br>
Mateusz Loskot, <a href="http://mateusz.loskot.net" rel="noreferrer" target="_blank">http://mateusz.loskot.net</a> _______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
SCISYS UK Limited. Registered in England and Wales No. 4373530.<br>
Registered Office: Methuen Park, Chippenham, Wiltshire SN14 0GB, UK.<br>
<br>
Before printing, please think about the environment.<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Med venlig hilsen<div><br></div><div>Bo Victor Thomsen</div><div><br></div></div></div></div>