Getting native ODBC drivers working

Below is a tutorial for getting native Windows ODBC drivers working under Wine.

Access 2000 can work with Wine, but this how-to doesn't require Microsoft Access.

This how-to explains how to set up Wine so it can run Windows programs that read and write to Jet (Access) databases using ODBC. They work fine on Windows and only require Mingw to to compile and link them, both for console programs and those using Windows SDK. You then can write interactive programs in C which use fully-featured SQL databases. No need to purchase Access.

With the set-up below they will also run on Linux (Kubuntu 9.04) with Wine 1.1.26.


First, install Jet Service Pack 4.0 and MDAC 2.8 using winetricks:

winetricks jet40 mdac28 

NB: I was unable to get winetricks to run on Debian Squeeze. I downloaded mdac28, Windows Scripting Host and finally jet40 from Microsoft's website. I then had to use winecfg and set MDAC_TYP.EXE to run with Windows Version Windows 2000 for it to install properly. The other two modules seemed to install okay -- Ashley Hooper

You need to update the Wine registry to 'install' the Access drivers for ODBC. From Windows, export the HKLM\Software\ODBC branch of the registry to a *.reg file. You can edit this file to remove drivers and DSNs you don't need. Then import this file using Wine's regedit.

To use Windows ODBC drivers, you'll have to override Wine's odbccp32.dll and odbc32.dll with their native versions, since the Wine versions are currently wired directly to Linux's unixodbc. You can do this with winecfg.

If you need to set up (System) DSNs, run

wine odbcad32.exe 

This will bring up the ODBC Data Source Administrator window, which you can use to enter a DSN name, select its driver and the .mdb file.

Your programs should then run in Wine as they did in Windows (but perhaps a bit slower).

See also

NativeOdbc (last edited 2012-03-27 03:29:48 by AshleyHooper)