Forum Discussion

mehashah's avatar
mehashah
Contributor
13 years ago

Microsoft OLE DB Provider for ODBC Drivers

Hello,



I am receiving "Microsoft OLE DB Provider for ODBC Drivers" Error box when trying to connect to Mysql database.

The same function used to run great before I upgraded to TestComplete 9.



Error appears in log as:

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



See my code below:



Sub DBConnection1()

Dim Connection

Dim ConnString

Dim Recordset

Dim PublisherIDSQL

  SQL = "select ID from <<DB>> where DeletedFlg = 0 and Name like +'<<Name>>'+"

  ConnString = "Driver={MySQL ODBC 5.1 Driver};Server=<<ServerName>>;Database=<<DBName>>; User=<<User>>;Password=<<Password>>;Option=3;"

  Set Connection = CreateObject("ADODB.connection")

  Set Recordset = CreateObject("ADODB.Recordset")

  Connection.Open ConnString

  Recordset.Open SQL,Connection

  Do While NOT Recordset.Eof   

    ID = Recordset.Fields("ID").Value

    ID = aqconvert.VarToStr(ID)

    log.message ("ID is:" ID)

    Recordset.MoveNext    

  Loop

  Recordset.Close

  Set Recordset=nothing

  Connection.Close

  Set Connection=nothing

End Sub



Let me know what I am doing wrong here?

Any help is appreciated.



Thanks.