[gdal-dev] Issues with Running ogr2ogr Script from SQL Server or Task Scheduler

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[gdal-dev] Issues with Running ogr2ogr Script from SQL Server or Task Scheduler

Joshua Geoghegan

Hi all,


I’ve have an ogr2ogr script (attached) that creates a kml from a sql database. This works fine, but if I run the batch file from SQL Server using xp_cmdshell I get the following message twice


ERROR 1: Can't load requested DLL: \\gissrv.ad.mps\data\ogr2ogr\gdalplugins\ogr_MSSQLSpatial.dll

126: The specified module could not be found.


The kml is created but without the geometries and smaller file size.


I ended up deciding on creating a scheduled task on our production server to run the batch every few hours, and the same problem occurs, the file is smaller without geometries.

I set environment path variables for GDAL, GDAL_DATA and GDAL_DRIVER but the problem remains.

The ogr2ogr files live on our GIS server, so I also tested by copying them locally on the Production server with no luck.


I then tested the scheduled task on our development server and it runs fine. I see there are some dll’s on C:\System32 on dev that aren’t in prod, including

  • SQLServerSpatial100,120,140, although 110 is on both servers.
  • Msodbcsql11 – I installed the driver but no luck
  • adalsql – I installed the driver but no luck


I am happy to go with the scheduled task on Development as I’ve spent a lot of time trying to get this working, but what would cause production to fail and why can’t I get it to work as SQL stored procedure?

Ideally I’d like the SQL option so the user can have the data on the fly.








Email: [hidden email]

Phone: 03 5950 1321

Private Bag 1000, Rosebud VIC 3939 | 90 Besgrove Street, Rosebud VIC 3939

Follow us on social media!


Latest News

Mornington Peninsula Shire acknowledges and pays respect to the Boon Wurrung/Bunurong people,
the traditional custodians of these lands and waters.

We are committed to carbon neutrality.


DISCLAIMER: This email (and attachments) is for the intended recipient only and may contain privileged, confidential or copyright information. If received in error, please notify sender immediately and delete. Any other use is prohibited. Shire accepts no liability for damage caused by this email (and attachments) due to viruses, corruption, delay, interruption, unauthorised access or use. Views expressed are those of the individual and not necessarily Shire. Shire will only collect personal information from you with your prior consent, use it for the purpose collected or as reasonably expected and not disclose without consent, except if required by law/regulation. For further information see our privacy policy:
Arrow mornpen.vic.gov.au/privacystatement

Consider the Environment

gdal-dev mailing list
[hidden email]

GMSC_Bushland_WMAExport.txt (4K) Download Attachment