Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to use VBScript to access a 32bit ODBC System DSN (Excel) on a Windows 7 64bit system?

$
0
0

What is the correct way to connect to a 32bit System DSN (Excel) on a Windows 7 64bit system?

 

I've recently switched from Windows XP Pro x32 to Windows 7 x64.  Now, one of my scripts that uses an ODBC connection will no longer work.  After a bit of searching, I discovered that Windows 7 x64 does not currently have 64bit Excel drivers.  However, you can set up 32-bit connections by running "C:\Windows\SysWOW64\odbcad32.exe".  Unfortunately, my script still won't work even though I set up the System DSN exactly like I did on my old computer.  When I run my script, I get the following error:

Quote:

Script:  X\XML_Check.vbs
Line:  212
Char:  3
Error:  [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application.
Code:  80004005
Source:  Microsoft OLE DB Provider for ODBC Drivers

Line 212 contains:
objConnection.Open "DSN=charge_codes_XLS;"

It seemed to me that wscript.exe will only communicate properly with an identical environment (x32 to x32 or x64 to x64, but not x64 to x32 or x32 to x64).  With that in mind, I found a way around the error by running my script via the 32bit version of Windows Script Host.  I changed the shortcut path from "X:\XML_CHECK.vbs" to "C:\Windows\SysWOW64\wscript.exe X:\XML_CHECK.vbs" and the script appears to function ok. 

What I really want to know is if there is a way to run my script via the 64bit version of wscript.exe yet have it connect to the 32bit ODBC subsystem? Is there a specific connection string I can use or am I just out of luck until Microsoft puts out 64bit Excel drivers?


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images