Why my 32 bit applications cannot see the ODBC DSNs that I created on my 64 bit machine ?
As we all database developers know that a ODBC DSN is an entry that we created through “ODBC Data Source Administrator” that we reached from Start/Control Panel/AdministrativeTools or typing “odbcad32” from Start/Run .
On a 64bit machine when you run “ODBC Data Source Administrator” and created an ODBC DSN, actually you are creating an ODBC DSN which can be reachable by 64 bit applications only.
But what if you need to run your 32bit application on a 64 bit machine ? The answer is simple, you’ll need to run the 32bit version of “odbcad32.exe” by running “c:\Windows\SysWOW64\odbcad32.exe” from Start/Run menu and create your ODBC DSN with this tool.
The key point here to remember is a 64bit machine should be considered as a “64 bit Windows + 32 bit Windows” at the sametime. That’s why the folder that our developers put the 32bit “odbcad32.exe” under C:\Windows\SysWOW64\ . The WOW abbreviation here means “Windows on Windows” 😉
That’s why, it might be a good idea to have a look at the C:\Windows\SysWOW64\ for the EXE files at least to know what sort of other EXEs/DLLs are also compiled as 32bit and shipped within your 64bit OS.
For example cscript.exe and wscript.exe are ther for your WSH (Windows Scripting Host) scripts which needs to be run as 32bit. Think about a scenario like that. Only the 32 bit version of the OLE DB Provider or ODBC Driver exists for the data source that you need to get the data from your VBScript code. If it’s the case, you’ll need create the ODBC DSN (assuming that you’re going to use ADO + ODBC in your VBScript code) from C:\Windows\SysWOW64\odbcad32.exe and also you should call your script as
“C:\Windows\SysWOW64\wscript.exe C:\scripts\myscript.vbs”.
Doubleclicking the myscript.vbs from the Windows Explorer will result your script to be executed as
“C:\Windows\System32\wscript.exe C:\scripts\myscript.vbs”.
Hope I managed explaining the WOW philosophy for a 64 bit Windows a little bit in my words and can help you in your projects 🙂