ODBC Databases: Jet/Access success

Barry Bird barry at ornithade.co.uk
Thu Jul 23 10:49:28 CDT 2009


Good Afternoon.

In section 3.3.6.2 of your User Guide you ask readers to report 
successes with databases other than MS SQL.  Well here's one (I know 
Access 2000 can work with Wine, but this doesn't require Access):

How to set up Wine to enable Windows programs that read and write to Jet 
(Access)
databases using ODBC.  I write such programs in C and use the API defined in

ODBC API Reference
http://msdn.microsoft.com/en-us/library/ms714562%28VS.85%29.aspx

They work fine on Windows and only require Mingw to be installed to 
compile and link them,
both for console programs and those using Windows SDK.
You then can write interactive programs in C which use a full-featured 
SQL database which
comes bundled with Windows. No need to purchase Access.

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

You need to update the registry to install the Access drivers. 
Under Windows, export from the Registry to *.reg files the registry entries
- HKLM\Software\ODBC
- HKLM\Software\Microsoft\Jet
all subsidiary keys and values come with them.

You can carefully edit these files to remove drivers and DSNs you don't 
need.

Import these files using the registry editor in wine:

wine regedit.exe.

You need to bring across from Windows to Windows\System32 under wine:

clbcatq.dll
comres.dll
expsrv.dll
msjet40.dll
mswstr10.dll
msjter40.dll
msjint40.dll
msjtes40.dll
msrd3x40.dll
odbc32.dll
odbccp32.dll
odbcji32.dll
odbcjt32.dll
odbcad32.exe
odbcint.dll 
odbctrac.dll
vbajet32.dll

Register this server in wine:
wine regsvr32.exe msjtes40.dll

No need to install MDAC.

To use Windows ODBC drivers, you have to override Wine's odbccp32.dll 
and odbc32.dll with the native
versions because the Wine versions are currently wired directly to 
Linux's unixodbc.

This can be done by setting up the ODBC Data Source Administrator 
odbcad32.exe using winecfg:
- Add the program to the Applications tab
- then in the libraries tab, pick from 'New override for library' drop-down
odbc32.dll and odbccp32.dll add them and edit them to be Native for Windows.

Then if you do

wine odbcad32.exe

this brings up the ODBC Data Source Administrator window as in the 
Windows Control Panel

If needed, set up (System) DSNs using this program.

Bring across the programs and *.mdb database files from Windows.

Using winecfg, you need to set up each program you want to run with 
overrides for odbc32.dll and odbccp32.dll
(Applications and Libraries tabs) as above.

The programs should then run as they did in Windows but perhaps a bit 
slower with:

wine Odbc-prog.exe

This has been tested twice on a clean .wine install.   I cannot vouch 
for support of all API and SQL facilities however.

I hope someone finds this useful.

Barry Bird




More information about the wine-devel mailing list