Hi Bo,

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.

Cheers,
Pete

From: gdal-dev <[email protected]> On Behalf Of Bo Victor Thomsen
Sent: 30 November 2018 14:13
To: [email protected]
Subject: Re: [gdal-dev] Import Shapefile into SQL Server on Ubuntu

Hi Pete -

Your first take on the commandstring probably contains an error...

ogr2ogr -f MSSQLSpatial  
"MSSQL:server=localhost;database=[database-name];username=sa;password=*****;trusted_connection=yes"
 [path-to-shape-file]

You probably hasn't made the necessary setup with kerberos to use "integrated 
security" (the  "trusted_connection=yes" part in the connection string)

This command might have worked ( no trusted_connection parameter):
ogr2ogr -f MSSQLSpatial  
"MSSQL:server=localhost;database=[database-name];username=sa;password=*****" 
[path-to-shape-file]

Your second take  doesn't contain the "trusted_connection" part
ogr2ogr -f MSSQLSpatial 
"MSSQL:server=[server];database=[database];uid=[username];Pwd=[password];Driver={ODBC
 Driver 17 for SQL Server}" [shape file]




--- Run ogr2ogr using driver
ogr2ogr -f MSSQLSpatial 
"MSSQL:server=[server];database=[database];uid=[username];Pwd=[password];Driver={ODBC
 Driver 17 for SQL Server}" [shape file]


Thanks,
Pete

-----Original Message-----
From: gdal-dev 
<[email protected]<mailto:[email protected]>> On 
Behalf Of Mateusz Loskot
Sent: 22 October 2018 16:31
To: [email protected]<mailto:[email protected]>
Subject: Re: [gdal-dev] Import Shapefile into SQL Server on Ubuntu

On Mon, 22 Oct 2018 at 17:25, Peter Marlow 
<[email protected]<mailto:[email protected]>> wrote:
>
> I’m trying to import a Shapefile into an SQL Server database using ogr2ogr on 
> Ubuntu. The command I’m running looks like:
>
> ogr2ogr -f MSSQLSpatial
> "MSSQL:server=localhost;database=[database-name];username=sa;password=
> *****;trusted_connection=yes" [path-to-shape-file]
>
> It returns an error stating:
>
> ERROR 1: Unable to find driver `MSSQLSpatial'.

I guess, GDAL/OGR version you are using on Linux is not built with ODBC/SQL 
Server support.

> 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.
>
> The docs here (https://www.gdal.org/drv_mssqlspatial.html) talk about
> 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.

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)

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.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net 
_______________________________________________
gdal-dev mailing list
[email protected]<mailto:[email protected]>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


SCISYS UK Limited. Registered in England and Wales No. 4373530.
Registered Office: Methuen Park, Chippenham, Wiltshire SN14 0GB, UK.

Before printing, please think about the environment.

_______________________________________________
gdal-dev mailing list
[email protected]<mailto:[email protected]>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
Med venlig hilsen

Bo Victor Thomsen

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to