<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Arial",sans-serif;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--> gfidisc.scisys.co.uk {color:black; !important} </style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<meta name="application-name" content="gfidisc.scisys.co.uk "> </head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Hi Bo,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Yes the original commandstring did have that error, however the main error was that I didn’t have access to the MSSQLSpatial driver because the ODBC
driver wasn’t bundled with the version of GDAL that I installed via conda-forge. When I installed GDAL via ‘apt-get install gdal-bin’ it did have the ODBC support.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Pete<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Bo Victor Thomsen<br>
<b>Sent:</b> 30 November 2018 14:13<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] Import Shapefile into SQL Server on Ubuntu<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Pete -<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Your first take on the commandstring probably contains an error...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">ogr2ogr -f MSSQLSpatial "MSSQL:server=localhost;database=[database-name];username=sa;password=*****<b>;trusted_connection=yes</b>" [path-to-shape-file]<br>
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This command might have worked ( no trusted_connection parameter):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">ogr2ogr -f MSSQLSpatial "MSSQL:server=localhost;database=[database-name];username=sa;password=*****" [path-to-shape-file]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Your second take doesn't contain the "trusted_connection" part <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">ogr2ogr -f MSSQLSpatial "MSSQL:server=[server];database=[database];uid=[username];Pwd=[password];Driver={ODBC Driver 17 for SQL Server}" [shape file]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><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" 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" 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" 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" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Med venlig hilsen<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Bo Victor Thomsen<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="gfidisc.scisys.co.uk" id="gfidisc.scisys.co.uk" style="gfidisc.scisys.co.uk"></p><a id="gfidisc.scisys.co.uk" title="gfidisc.scisys.co.uk" href="gfidisc.scisys.co.uk" class="gfidisc.scisys.co.uk" style="text-decoration: none !important;"></a><gfidisc.scisys.co.uk/><h1 class="gfidisc.scisys.co.uk" style="gfidisc.scisys.co.uk"></h1><p><span style="color: #0000ff; font-family: Tahoma; font-size: small;"> </span></p>
<div align="left"><span style="color: #808080; font-family: Arial; font-size: small;">SCISYS UK Limited. Registered in England and Wales No. 4373530.</span></div>
<div align="left"><span style="color: #808080; font-family: Arial; font-size: small;">Registered Office: Methuen Park, Chippenham, Wiltshire SN14 0GB, UK.</span></div>
<div align="left"> </div>
<div align="left"><span class="400184714-12042007"><span style="color: #000000;"><span style="font-size: 7pt; font-family: Tahoma;"><span style="font-size: xx-small;"><span style="color: #008000;"><span style="font-family: Arial;">Before printing, <span class="296245114-12042007">please </span>think about the environment<span class="296245114-12042007">.</span></span></span></span></span></span></span></div><p class="gfidisc.scisys.co.uk" id="gfidisc.scisys.co.uk" style="gfidisc.scisys.co.uk"></p><a id="gfidisc.scisys.co.uk" title="gfidisc.scisys.co.uk" href="gfidisc.scisys.co.uk" class="gfidisc.scisys.co.uk" style="text-decoration: none !important;"></a><gfidisc.scisys.co.uk/><h1 class="gfidisc.scisys.co.uk" style="gfidisc.scisys.co.uk"></h1></body>
</html>