Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Good afternoon. I am trying to use an ArcGIS (10.2) personal database MDB as a container for data to pass to a QGIS user. I formerly used QGIS 1.8 for Mac OSX, and after some fiddling around, I was able to open a personal geodatabase and load one or more features from it.

I just upgraded to QGIS 2.0 and upon trying to check my MDB test file before sending to my colleague, I am unable to load the geodatabase. In fact, personal geodatabase as a file type no longer appears in the available types QGIS is prepared to open in the File Type drop down box in the load vector data operation.

Is there some setting I need to tweak or an additional plugin I need to install in order to regain this functionality?

Thanks, Russell

share|improve this question
    
I see someone else has asked a similar question: Personal Geodatabase not recognized as valid datasource in the last QGIS Windows Weekly build (64 bits). I am using Mac OS X Mtn Lion and installed the 64-bit build. –  Russell Collier Oct 2 '13 at 21:53
    
if ogrinfo says it can read it, then you shouldn't have any problems. what orginfo /path/to/db.mdb says? –  nickves Oct 2 '13 at 21:54
    
Hm. When I try run ogrinfo from a command line, it tells me command not found. –  Russell Collier Oct 2 '13 at 22:08
1  
That's strange. I thought qgis comes along with ogr/gdal (since most of the times qgis wraps around the functionality of those libraries). Maybe i am mistaken and thats not the case anymore? On a side note, I miss spelled the command. The correct command is ogrinfo –  nickves Oct 2 '13 at 22:13
    
It is possible that it requires a full path to the command file, "orginfo"? I installed everything on the kyngChaos download page. Maybe I need to do a shutdown & restart? –  Russell Collier Oct 2 '13 at 22:15

4 Answers 4

It doesn't look like the Java-based MDB driver is included in the most recent GDAL-Complete framework. Please file a request with kyngchaos.com, though understand there may be issues with creating a one-size-fits-all package installer (see JAVA note below). IMHO, the Java-based MDB driver is the only reliable means of reading MDB files for Mac OS X, as of now, since the PGeo and related Geomedia drivers fail to function anymore via ODBC.

I have a patch for compiling-in the Java-based MDB driver for Mac that was applied to the GDAL 2.0 branch, but not to the upcoming 1.10.2. There is also a homebrew pull request. Nether of those will help a current Kyngchaos.com install to support MDB, though.

In the meantime, if you don't mind trying it yourself, you can attempt to build a shared plugin for GDAL 1.10, install it, and see if it works with your data source:

  1. Ensure you have XCode and/or its command line tools installed.

  2. Download the GDAL source (MUST match same GDAL version as Kyngchaos.com's) and un-archive to folder, then enter and configure the build for basic defines for your OS (no other options necessary):

    $ cd /path/to/gdal-1.10.1
    $ ./configure
    
  3. Build shared plugin:

    # make directory for build output
    $ mkdir ogr_plugins
    
    # compile shared plugin (multi-line, single command)
    $ g++ -Wall -g ogr/ogrsf_frmts/mdb/ogr*.c* -shared -o ogr_plugins/ogr_MDB.dylib \
      -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mdb \
      -I/System/Library/Frameworks/JavaVM.framework/Headers \
      -framework GDAL -framework JavaVM
    
    # fix lib id
    $ install_name_tool -id ogr_MDB.dylib ogr_plugins/ogr_MDB.dylib
    
    # copy plugin to known GDAL_DRIVER_PATH (sudo needed)
    $ sudo cp -f ogr_plugins/ogr_MDB.dylib /Library/Application\ Support/GDAL/1.10/PlugIns/
    
  4. Install necessary *.jar support files (or the driver will not work at all). See the MDB driver page, under How to run the MDB driver (on Linux) for details. Ignore step #1 and for step #3 substitute /Library/Java/Extensions for lib/ext. I used the noted downloads from the related mdb-sqlite project on that page, browse source here.

  5. Verify plugin:

    $ cd /Library/Application\ Support/GDAL/1.10/PlugIns
    $ otool -L ogr_MDB.dylib
    ogr_MDB.dylib:
        ogr_MDB.dylib (...)
        /Library/Frameworks/GDAL.framework/Versions/1.10/GDAL (...)
        /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM (...)
        /usr/lib/libstdc++.6.dylib (...)
        /usr/lib/libSystem.B.dylib (...)
    
    $ ogrinfo --formats | grep 'MDB'
    -> "MDB" (readonly)
    
  6. Launch QGIS and verify plugin loading in PyQGIS console:

    from osgeo import ogr
    sorted([ogr.GetDriver(drv).name for drv in range(0,ogr.GetDriverCount())])
    
  7. You should be able to load a MDB data source via Add Vector Layer > File > Browse, or try drag/drop of *.mdb file. Note, *.mdb files do not yet show up in the browser panel.

If you have MDB driver support in GDAL, but for whatever reason QGIS does not load the file, or because the loading in QGIS is very slow, try using the ogr2ogr utility to convert the layers to a more useable format.

IMPORTANT NOTE ABOUT JAVA: The above plugin build command assumes an Apple-supported install of Java 1.6.x. However, since Apple has dropped support for native Java installs, and now (since 10.8) recommends users download and install the latest Java from Oracle, adjust the commands to accommodate an Oracle install:

  • (supplement to #1 above) Update Java Home path link. If Oracle Java has been installed, this is not updated and may point to old Apple-supported Home (i.e. now a broken symbolic link).

    $ cd /Library/Java
    $ sudo rm Home
    $ sudo ln -s $(/usr/libexec/java_home) .
    

    Note: if you update your Java version, you will probably have to update this symbolic link as well, and maybe recompile the shared plugin, if you want to use the new Java version.

  • (replaces #3 above) Build shared plugin:

    # make directory for build output
    $ mkdir ogr_plugins
    
    # compile shared plugin (multi-line, single command)
    $ g++ -Wall -g ogr/ogrsf_frmts/mdb/ogr*.c* -shared -o ogr_plugins/ogr_MDB.dylib \
      -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mdb \
      -I/Library/Java/Home/include -I/Library/Java/Home/include/darwin \
      -L/Library/Java/Home/jre/lib/server -ljvm -framework GDAL
    
    # fix lib id and Java lib path
    $ install_name_tool -id ogr_MDB.dylib ogr_plugins/ogr_MDB.dylib
    $ install_name_tool -change @rpath/libjvm.dylib \
      /Library/Java/Home/jre/lib/server/libjvm.dylib ogr_plugins/ogr_MDB.dylib
    
    # copy plugin to known GDAL_DRIVER_PATH (sudo needed)
    $ sudo cp -f ogr_plugins/ogr_MDB.dylib /Library/Application\ Support/GDAL/1.10/PlugIns/
    

Please post if you have success with this shared plugin method for reading MDB files.

share|improve this answer
    
thanks for this writeup. I adapted your instructions successfully to enable my locally built libgdal/ogr2ogr to read mdb files. I used this line to compile/link the plugin: clang++ -Wall -g ogr/ogrsf_frmts/mdb/ogr*.c* -shared -o ogr_plugins/ogr_MDB.dylib -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mdb -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM .libs/libgdal.a -stdlib=libstdc++ –  Dane Mar 3 at 2:26
    
I just want to give a warning to users unfamiliar with managing qgis's dependencies. By doing this you may break qgis. –  boulder_ruby Jun 3 at 15:03
    
This will not break QGIS. GDAL is merely a dependency. QGIS may not launch if the shared plugin fails to load, and GDAL throws an app-crashing error. To check that the plugin is loading properly, simply issue ogrinfo --formats and look for any dylib issues. This is part of Step #5, noted above. –  dakcarto Jun 3 at 17:38

Try 32-bit version - on Windows it works.

share|improve this answer
1  
32 bit version of QGIS? –  user3461 Nov 7 '13 at 16:24
    
Hmm. Not sure why this was down-voted. If a Mac user has a Windows VM or machine, and uses the 32-bit QGIS version on that platform (which I think still supports reading MDB), then this is a valid answer. –  dakcarto Nov 7 '13 at 19:42
    
Yes, there is a 32- and 64-bit version of QGIS on Windows, via the OSGeo4W installer. The 64-bit version is a recent addition. –  dakcarto Nov 7 '13 at 19:47
    
Yes, try install 32bit QGIS. I have installed 64bit QGIS on 64bit W7 and there was a problem. After reinstallation of 32bit QGIS on 64bit W7 everything is okay. –  JerrY Nov 8 '13 at 16:54

I think the answer is simply not using personal geodatabase. Even Esri dislikes the format, why not just give them shapefiles, kml, gml, geojson...anything but mdb...

Just to back up my Esri dislikes personal geodatabase claim...

http://downloads2.esri.com/support/TechArticles/ArcGIS10and101Deprecation_Plan.pdf

ArcGIS Server 10.1 will no longer support the Microsoft Access based Personal Geodatabase. With the migration of ArcGIS Server to be 64bit and because of the lack of scalability of Personal Geodatabases, we have removed support for Personal Geodatabases from ArcGIS server 10.1. [Page 7 of 8, bullet #4]

share|improve this answer
1  
My simple reply is that I inherited a huge inventory of data already compiled to personal geodatabase format. I need to make it available to my colleague in a format he can access. I rather suspect this means converting several hundreds of Gb of data back out to say, shapefiles, or KMLs. The file format itself has limitations but also advantages. Process-wise, for us it is simpler if the software can simply read the data and then move it into a POSTGIS database afterward. –  Russell Collier Oct 3 '13 at 5:31
    
ahhh...the dreaded legacy data... Have you seen: gdal.org/ogr/drv_pgeo.html –  bcollins Oct 3 '13 at 14:42

This is certainly a non-programmer's answer, but as an end user I have to do what I have to do.

Simply, I installed Lisboa 1.8 and use it to pull out shapefiles from ESRI personal geodatabases. Afterwards, I access them through QGIS Dufour 2.0.

Not a very elegant solution, but it works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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