I downloaded the Precints shapefile from the City of Boston's data hub, and I'm trying import it into SQLServer (I'm running the Express verson). I've already created the database in the SQLServer (but not the tables), so now I'm using OGR to import the data. I keep getting this error:"FAILURE: Unable to open datasource 'precints.shp' with the following drivers."

Here's what I've written in the OSGeo4W command prompt:

ogr2ogr –f “MSSQLSpatial” “MSSQL:server=Comp1\SQLExpress;database=Precints-ogr2ogr; trusted_connection=yes” “Precincts.shp”

I've tried downloading the data again, but no luck. I tried getting rid of the XML file that has the same name as the .shp file, but it still didn't work.

Any idea on how to fix this?

  • do you have the rest of the shapefile? You'll need (at least) Precincts.dbf and Precincts.shx (en.wikipedia.org/wiki/Shapefile) – Ian Turton Nov 5 '12 at 8:43
  • Try to specify full path to shape file. Also test your MSSQL connection using orginfo - if success ogrinfo should report zero layers in your database. – Dmitry Baryshnikov Oct 7 '16 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.