cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving error message 'Microsoft OLE DB Provider for ODBC Drivers'

Highlighted
Contributor

Receiving error message 'Microsoft OLE DB Provider for ODBC Drivers'

Using the section of code below, I am receiving an error message stating:

 ---------------------------

TestComplete

---------------------------

An exception occurred in the "sc_Common_Functions" unit at line 966:

Microsoft OLE DB Provider for ODBC Drivers

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

---------------------------

OK  

---------------------------



The code previously worked and now is no longer working.  What could be my problem?  Below is the section of code where the issue occurs.  The error occurs on the line: aCon["Open"]();.



function ReadInSQLData(TableName, Col1, Row1, Col2)

{

//This function reads in one piece of data from a table based on

//data from another column. ???This may not work if a third row of

//data is required (if more than two lines have the same data).

var aCon, aCmd, aRecSet, iRow, iColumn, Row2;

var MainColumn, ColumnToChoose;



// Creates ADO connection

aCon = ADO["CreateConnection"]();

// Sets up the connection parameters

aCon["ConnectionString"] = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Automation; Database=" + SQL_MainDatabase;

// Opens the connection

aCon["Open"]();

// Creates a command and specifies its parameters

aCmd = ADO["CreateCommand"]();

aCmd["ActiveConnection"] = aCon; // Connection

aCmd["CommandType"] = adCmdTable; // Command type

aCmd["CommandText"] = TableName; // Table name

// Opens a recordset

aRecSet = aCmd["Execute"]();

aRecSet["MoveFirst"]();

...



Mike



P.S.  The same code works fine on a different computer.
2 REPLIES 2
Highlighted
Contributor

RE: Receiving error message 'Microsoft OLE DB Provider for ODBC Drivers'

Our ODBC specialist worked with the code and found a workaround.  We do not know why this works, but it does.  According to the documentation the code is similar and should work the same.  The line:


aCon["ConnectionString"] = "Provider=MSDASQL.1;Persist Security Info=False; Data Source=Automation; Database=" + SQL_MainDatabase;



 


was changed to:

aCon["ConnectionString"] = "Provider=sqloledb;Integrated Security=SSPI; Server=(local)\\P3Plus; Database=" + SQL_MainDatabase;


Why would Test Complete complain about the first line, but be okay with the second line?



Mike


Highlighted
Staff

RE: Receiving error message 'Microsoft OLE DB Provider for ODBC Drivers'

Hi,



According to the exception you get, the problem is in the provider you're using. Probably, the appropriate DB driver is either not installed or corrupt on the problematic machine.

------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors