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
-
The errors might be pointing to a issue on the sql server end. Does it have enough memory?Nathan W– Nathan W2016年07月05日 03:18:45 +00:00Commented Jul 5, 2016 at 3:18
-
@NathanW I thought that may be an issue, but there are 70 odd Gigabytes freeuser32496– user324962016年07月05日 06:08:08 +00:00Commented Jul 5, 2016 at 6:08
2 Answers 2
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.
-
2The question makes no mention of using QGIS so how does this answer apply to it?2016年08月31日 03:07:04 +00:00Commented Aug 31, 2016 at 3:07
-
2I 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...Dan– Dan2016年08月31日 05:55:07 +00:00Commented Aug 31, 2016 at 5:55
-
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).