Issue with ADODB connection on Window 7 using VBScript – Resolved


Recent days, I have seen enterprises are migrating their operating systems (OS) from XP to Windows 7 as Microsoft announced the end of support for Windows XP. This resulted in migration of applications,automation scripts and everything else on new OS. In this post we will be discussing about one of the issues which I faced and most of others also had the same situation with their script while migrating to Windows 7 i.e  ADODB connection on Window 7 using VBScript. 

ADODB connection is used in VBScript to connect to the Database(Oracle/Sybase/DB2/SQL Server/Excel) and fetch the required data from databases .We have one of such VB script file which fetches the values from Database using ADODB object.The vbs file was getting executed without any error on Windows XP. But when we tried to execute it on Windows 7  ,we received the below error :

Windows Script Host
Script: C:\connectDB.vbs
Line: 5
Char: 1
Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Code: 80004005
Source: Microsoft OLE DB Provider for ODBC Drivers

The reason for the above error is related to the way the VB Script communicates with the Operating System. Windows 7 is of  64 bits while the ADODB driver is available only in 32 bits.When the VBScript file is invoked on 64 bits OS ,by default it will be invoked by 64 bit Wscript/CScript interpreter which lead to ADODB error.

To resolve ADODB connection issue ,follow the below steps:

Open a  cmd prompt.
Navigate to the path (C:\Windows\SysWOW64).
Copy the script path.
Click Enter.

Instead of opening command line everytime,batch file can be created by following the below steps:

Open a notepad

Type "Call C:\Windows\SysWOW64  VBScript File Location and Name"

Save the file as .bat file

Double click on the file.

 Note : You don’t need to use the 32 bit WScript/CScript interpreter everytime while using the vbs file.It is only needed when you are doing connections to Database/Quality Centre/ALM.

Hope this article helps you in your smooth migration of your automation script from Windows XP to Windows 7 by resoling ADODB connection issues.If you face any issues related to the migration of automation scripts feel free to contact us.

Till then

Happy learning!!!!



Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.