2

I'm trying to read ESRI personal geodabase.mdb through OGR. I have my driver "PGeo" but when I write

ogrinfo INFLOR090812.mdb

I have this bug:

ERROR 1: Unable to initialize ODBC connection to DSN for DRIVER=Microsoft Access Driver (*.mdb);DBQ=INFLOR090812.mdb, [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'. ERROR 1: Unable to initialize ODBC connection to DSN for DRIVER=Microsoft Access Driver (*.mdb);DBQ=INFLOR090812.mdb, [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.

Someone could connect to a database.mdb to read the shapefiles in MapServer?

1

1 Answer 1

1

As noted in a comment by neuhausr there is a documented solution for this problem on the GDAL site GDAL info page for ESRI Personal GeoDatabase, but the solution is only for Linux.

If like me you find yourself on a 64-bit Windows platform and have 64-bit MapServer/GDAL you might find yourself scratching your head, as yes you can get the same error :-(

msDrawMap(): Image handling error. Failed to draw layer named 'OGE_1M_surface_GeologicUnit'. msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `OGE_1M_surface_GeologicUnit'. Unable to initialize ODBC connection to DSN for DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:/WxS/ms/apps/published/BGS_OGE_Bedrock_and_Surface_Geology/data2/OGE.mdb, [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

For me the solution was as follows:

Download/install the 64-bit version of the ODBC driver: Microsoft Access Database Engine 2010 Redistributable

Now in your MapServer map file you need to add the following two CONFIG options:

CONFIG "PGEO_DRIVER_TEMPLATE" "DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=%s"
CONFIG "OGR_SKIP" "ODBC"

These config options are discussed in GDAL bug 5594 ~ Problem reading MDBs (64-bit)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.