Link to home
Start Free TrialLog in
Avatar of Kumaran_1
Kumaran_1

asked on

QTP, issue connecting to Oracle DB

I am running below mentioned function in QTP ,
I get error "Provider cannot be found. It may not be properly installed.".Though I have installed oracle client on my machine(Oracle Runtime(213MB)).
Can please some one suggest whats missing.


Function:
Function Get_Id
      
            
      Dim objConn
      Dim objRecordset
      Dim strSQL

      Set objConn = CreateObject("ADODB.Connection")
      Set objRecordset = CreateObject("ADODB.Recordset")


  objConnectOracleReuse.ConnectionString = "Provider=OraOLEDB.Oracle; Data Source=(DESCRIPTION=(CID=GTU_APP)"  & _
               "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myHostName)(PORT=port)))" & _
               "(CONNECT_DATA=(SID=sid)(SERVER=DEDICATED))); User Id=userId; Password=pwswrd;"

  strSQL = "SELECT MAX(COLUMN_NAME) AS VALUE FROM TABLE_NAME"
      

      objConn.Open
      objRecordset.Open strSQL,objConn
      
      Dim obj
      obj =  objRecordset.fields.item("VALUE")

      Msgbox obj
      objRecordset.Close
      objConn.Close

      Set objConn = Nothing
      Set objRecordset = Nothing

End Function
ASKER CERTIFIED SOLUTION
Avatar of schwertner
schwertner
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kumaran_1
Kumaran_1

ASKER

I already have this information, hostName, sid, port.Didn't add to this post.Some issue exist in oracle client installation.nOT SURE WHAT IT IS.