1

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

asked Jul 4, 2016 at 12:40
2
  • The errors might be pointing to a issue on the sql server end. Does it have enough memory? Commented Jul 5, 2016 at 3:18
  • @NathanW I thought that may be an issue, but there are 70 odd Gigabytes free Commented Jul 5, 2016 at 6:08

2 Answers 2

1

This happened to me after upgrading QGIS from 2.12 (Lyon) to 2.16 (Nodebo). I rolled back to QGIS Lyon 2.12.1 and it worked again.

answered Aug 31, 2016 at 2:51
3
  • 2
    The question makes no mention of using QGIS so how does this answer apply to it? Commented Aug 31, 2016 at 3:07
  • 2
    I meant I've been using OGR2OGR to upload shapefiles to SQL Server (nearly identical syntax as op's), and it worked fine until I decided to upgrade QGIS, then got the same exact error, i.e. ERROR1:INSERT command... ogr2ogr.exe is in the \bin folder of QGIS. Rolling back QGIS to previous version fixed the error. ergo... Commented Aug 31, 2016 at 5:55
  • As a new user be sure to take the 2-minute Tour to learn about the site and its protocols. There is an edit button beneath your answer that you can use to make your answer clearer. Commented Aug 31, 2016 at 6:15
0

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).

answered Oct 17, 2016 at 4:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.