QTP – Fix for 64bit OS Scripting Errors for ODBC and ActiveX

Automation Guild Online Conference Top ad

WTF!!

Have you ever tried to run some existing QTP scripts on a Windows 64 bit OS only to be frustrated by odd errors?

Recently, I was helping a friend get his machine setup to run some scripts that I had created for him.

Everything ran fine on my 32bit OS machine, but when I attempted to run the same script on his machine, numerous errors began popping up almost immediately.

Following are the two 64bit specific issues I have seen, as well as the fix for them:

ODBC – The specified DSN contains an architecture mismatch Error

The first test I had issues with needed an ODBC System DSN setup on the test machine in order for the script to work. No problem. I went into Programs>Administrative Tools>Data Source (ODBC) and setup a DSN like I normally would. I also Ran the ‘Test Data Source' option successfully.


Okay cool. So then I go to run the script, and crash! The script throws this Run Error:


“[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application”


After some head scratching, I finally figured out that the default ODBC Data Source Administrator is the 64bit version — not 32bit. DUH!

How to resolve QTP 64bit ODBC issue

To resolve the issue, all you need to do is evoke the 32 bit ODBC Data Source Administrator instead. The quickest way to do this is enter: C:\Windows\SysWOW64\odbcad32.exe in the Start>Run menu.


This will bring up the correct ODBC setup. You can then enter your System DSN info, and should be good to go.

ActiveX component can't create object error

The other issue I had was with a script that used Excel. Whenever I called an Excel function in my .vbs function library, I'd get this error:

ActiveX component can't create object: ‘Excel.Application'


Once again, this worked fine on all my 32bit machines, but crashed (with the same error) on all my 64bit OS machines.

When running VBscript on a 64bit OS, the default Windows Scripting host is the 64bit, and it expected to find a 64bit DLL and EXE to be started. And because QTP doesn't have a 64bit entry point, it chokes.

How to fix the 64bit ActiveX error

Just like the ODBC issue we saw earlier, we also need to explicitly tell QTP to use the 32bit version of the scripting host. To do this, simply go to a command line and type in the path to the 32bit scripting host.

c:\windows\SysWOW64\cscript.exe followed by the name of your vbs file in quotes


Rerun your script. You should no longer see the Active X error.

Hope this helps. Happy 64bit Testing!

5 comments
Sonu - October 10, 2012

Hi,
I am trying to run the testsets in the ALm thru the VBscript file.
And in the code i have the below line
Set ObjScheduler = objtestset.startexecution(“”)

And i am getting ActiveX component cant create object Error.

But this message is inconsistent.

Reply
    Joe Colantonio - October 11, 2012

    Sonu » Do you keep getting the message on the same machine even after following the steps that I have to resolve this error?

    Reply
Soumen Chakraborty - December 24, 2013

I created a DSN from C:\Windows\SysWOW64\odbcad32.exe to connect Oracle. The ‘Test Connection’ showed ‘Connection Successful’. But on executing the QTP script using the same DSN gives the error “TNS could not resolve the connect identifier specified”. I am using QTP 11 in Windows 7 Professional machine. Please help.

Reply
    Joe Colantonio - December 27, 2013

    have you tried these suggestions:

    Reply
      Soumen Chakraborty - January 8, 2014

      I have tried your suggestions but the issue cannot be resolved.

      Reply
Click here to add a comment

Leave a comment: