Saturday, 4 April 2015

gdal - Writing shapefile to SQL Server database with ogr2ogr Error


I have been using ogr2ogr to write point shapefiles to a SQL Server Database of mine.


I used it 2 weeks ago and it worked fine, but, today when I tried to run it, I get the following error:


ERROR1: INSERT command for new feature failed. [Microsoft][SQL Server Native Client 11.0]Memory allocation failure`


ERROR1: Unable to write feature 0 from layer points.`

I used -skipfailures to see what output is produced, and only some of the results are written to a sql table, in this case I have 8 points, and only 5 have been written to a sql table... what could be causing this to happen? Here is the ogr2ogr command I am using, ogr2ogr -f MSSQLSpatial "MSSQL:server=servername\SQL2012;database=db;UID=username;PWD=password" C:\Pathtoshape\points.shp


I am wondering if I have fatally altered my code by mistake, or is there some other reason and now it is causing this error...


I am working on a solution, and hopefully I or someone else can find the solution, this question hasnt worked for me: ESRI Shapefile not loading into SQL Server



Answer



I cannot confirm the cause, but this error occurs for me when using gdal 2.1.1. Downgrading gdal to 2.0.1 fixes this issue (haven't tried any versions in between, those two I had available).


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...