[gdal-dev] Seeking assistance with an OGR2OGR => SQL Server (esri geodatabase) Issue

Ryan Dammrose ryandammrose at gmail.com
Thu Oct 15 18:33:28 PDT 2015


Hi there,

The Issue:
I am trying to use ogr2ogr to put a shapefile into a SQL Server table that
is also an esri geodatabase.  I have done this successfully before in the
past with SQL Server 2012 and esri 10.2, running from C#.

I am now attempting to do it with SQL Server 2014 and esri 10.2.2, running
from Python, and am running into a confounding and frustrating issue.  If I
run the following command on a regular SQL database, it works just fine:

'ogr2ogr -f "MSSQLSpatial"
"MSSQL:server=server;database=database;trusted_connection=yes;"
"C:/Users/username/Desktop/Test_Shapefile.shp" -lco "SRID=4326" -lco
"GEOM_TYPE=GEOMETRY" -lco "SCHEMA=DBO" -lco "OVERWRITE=YES" -nln
"TEST_TABLE" -overwrite'

If I point it to an esri geodatabase, however, I get this error:

ERROR 1: Error initializing the metadata tables : [Microsoft][ODBC SQL
Server Driver][SQL Server]There is already an object named
'geometry_columns' in the database.
ERROR 1: Error initializing the metadata tables : [Microsoft][ODBC SQL
Server Driver][SQL Server]There is already an object named
'geometry_columns' in the database.
ERROR 1: Terminating translation prematurely after failed
translation of layer Test_Shapefile (use -skipfailures to skip errors)

Interestingly, if I make an ogrinfo connection to the same database, I get:

ERROR 1: Error initializing the metadata tables : [Microsoft][ODBC SQL
Server Driver][SQL Server]There is already an object named
'geometry_columns' in the database.

INFO: Open of `MSSQL:server=MAPLION-PC;database=GIS;trusted_connection=yes;'
      using driver `MSSQLSpatial' successful.

followed by a listing of my tables in the database.  This happens for every
SDE/geodatabase-enabled database I have tried it on.

Does anyone have any ideas what may be causing this issue?  Thank you.

-Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151015/021c9024/attachment.html>


More information about the gdal-dev mailing list