login
Acc2K to ODBC to MySQL on Win7 x64 posted: Mon 2013-02-18 20:14:35 tags: tech
One of the larger problems with porting this Acc2K app (or technically, collection of apps) to xAMP is that there's too much data to be neatly amenable to portage via dumping and importing. My plan to bridge the transitional period and make data sync'ing sane was to add support into the Acc2K MDB project to "flip" between native and MySQL data sources. I'd done a lot of groundwork back in 2010 before a series of other distractions backburnered the porting project.

Acc2K and the MySQL ODBC Connectors worked more or less as expected on WinXP. With the advent of 64-bit Windowses, supporting Acc2K-to-ODBC started getting a bit complicated.

32-bit Acc2K requires a 32-bit MySQL Connector. Fair enough. The ODBC manager found via Control Panel ~ Administrative Tools ~ Data Sources (ODBC) in x64 Windows invokes %windir%\system32\odbcad32.exe, which is the 64-bit ODBC admin tool. 32-bit drivers must be configured with the 32-bit admin tool at %windir%\SysWOW64\odbcad32.exe. If you didn't know much about Windows you might assume system32 implies 32-bitness and SysWOW64, 64-bitness, but in fact it's the reverse - the SysWOW64 folder provides 32-bit legacy-compatibility versions of the 64-bit system components in system32.

Not knowing all this, I of course installed the 64-bit Connector v5.2.4, and the Control Panel ~ Admin Tools ~ Data Sources (ODBC) tool "saw" it, but of course Access did not. So I fell back to the 32-bit connector. I'd intended to uninstall the 64-bit connector, but rushed and ended up with both 32- and 64-bit connectors installed. Now the MySQL ODBC 5.2w driver was usable via the 32-bit ODBC Admin utility at %SystemRoot%\SysWOW64\odbcad32.exe "Create New Data Source".

So I stepped through creating a System DSN. Now in Acc2K, File ~ Get External Data ~ Link Tables ~ Files of Type... ODBC() ~ Machine Data Source presented the named System DSN as expected, but did not retrieve table names. Suspecting a privileges issue, I did GRANT ALL on [db_name] TO '[user]'@'localhost' IDENTIFIED BY '[pwd]' and FLUSH PRIVILEGES, but for some reason that didn't take; I ended up assigning privileges via SQLyog's User Manager facility. With that done, Access received a list of tables in the MySQL db represented by my ODBC System DSN. Linking one, I verified I could read data.