Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with using Excel ODBC connection on Win7 x64

Status
Not open for further replies.

PPettit

IS-IT--Management
Sep 13, 2003
511
US
I've recently switched from Windows XP Pro x32 to Windows 7 Pro x64. Now, one of my scripts that uses an ODBC connection will no longer work.

As some of you may know, Windows 7 doesn't appear to have proper support for 32-bit ODBC connections if you go through "Control Panel->Administrative Tools->Data Sources (ODBC)". This is for 64-bit drivers, apparently. After some googling, I found that there is a way to set up 32-bit connections by running "C:\Windows\SysWOW64\odbcad32.exe". However, 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:
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:
Code:
objConnection.Open "DSN=charge_codes_XLS;"
If it makes a difference, objConnection is created like so:
Code:
Set objConnection = CreateObject("ADODB.Connection")

Since the error message mentions an "architecture mismatch", I wonder if you have to use a different connection string depending on how you set up the DSN (through the x64 interface or the the x32 interface).

Anyone have any ideas on what's going and how to correct it?
 
I could be missing something, but that thread hasn't been helpful.

The only thing that I haven't tried is installing MDAC 2.8 because the description says that it's not supported for anything beyond WindXP and is for 32 bit systems only. Also, other people claim that it will not install properly on Win7 x64.
 
I found a solution to my problem. It appears that the "architecture mismatch" error was being caused by Windows Script Host. I have a 32-bit DSN but was trying to access it via a 64-bit app.

It seems obvious (now) that VBScripts would run in a 64bit environment by default on Windows 7 x64. Once I changed my shortcut to run the x32 version of wscript.exe, my script ran without a problem. All I did was change my shortcut from
Code:
X:\XML_CHECK.vbs
to
Code:
C:\Windows\SysWOW64\wscript.exe X:\XML_CHECK.vbs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top