Highlighted
Syed Tousif
New Member.
213 views

Unable to connect to Oracle database using Microsoft ODBC Driver for Oracle

Hi,

 

I have the below code in UFT to coneect to oracle database. 

Dim dbCon
    Dim recordSet 
    Dim strQuery, strCon 
    
    strQuery = "select eservice.serviceid from sapsr3.eservice where eservice.int_ui =(select euitrans.int_ui from SAPSR3.EUITRANS where ext_ui LIKE '6305798218%') and eservice.service='FRMP' and eservice.service_end = '99991231'"
    
    Set dbCon = CreateObject("ADODB.Connection")
    Set recordSet = CreateObject("ADODB.RecordSet")
        
    strCon = "Driver={Microsoft ODBC for Oracle};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lncidf2)(PORT=1526))(CONNECT_DATA=(SID=AUS)));Uid=AUTOTEST;Pwd=Ohgdfhd767;"
    
    dbCon.Open strCon
    recordSet.Open strQuery, dbCon    
    
    Do While Not recordSet.EOF
        Debug.Print recordSet.Fields(0).Value
        recordSet.MoveNext
    Loop
    
    dbCon.Close

 

On running the above code, i get the below error:

[Microsoft][ODBC driver for Oracle][Oracle]

Line (14): "dbCon.Open strCon".

The same vb code works without any problem from Excel.

Please help.

0 Likes
1 Reply
RajkumarR Outstanding Contributor.
Outstanding Contributor.

Re: Unable to connect to Oracle database using Microsoft ODBC Driver for Oracle

Try the third alternative in Connection Strings "Without TSN.ora alternative".

_____________________
Rajkumar Rajangam
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.