Micro Focus QTP (UFT) Forums
Creating QTP Script to run on TOAD - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Creating QTP Script to run on TOAD (/Thread-Creating-QTP-Script-to-run-on-TOAD)



Creating QTP Script to run on TOAD - kikoman16 - 03-12-2009

Hi Guys,

Can someone help me getting started in creating a QTP script that will run a query on TOAD or any other Oracle application

How can i connect to the DB with multiple instance

Thanks


RE: Creating QTP Script to run on TOAD - jayaraj - 09-28-2009

Can Someone help on this?? Is there any other automation tool that supports TOAD?

Thanks


RE: Creating QTP Script to run on TOAD - elsekra - 09-28-2009

Hello ;

Here a exemple how using ODBC to connect to Orale database and execute and get the results:

Const adOpenStatic = 3
Code:
    Const adLockOptimistic = 3
    Const adUseClient = 3

    Set objConnection = CreateObject("ADODB.Connection")
    Set objRecordset = CreateObject("ADODB.Recordset")
    
    objConnection.Open "DRIVER={Microsoft ODBC for Oracle};Server=" & sG_Database & ";UID=" & sG_DBUser & ";PWD=" & sG_DBPwd
    objRecordset.CursorLocation = adUseClient
    objRecordset.CursorType = adopenstatic
    objRecordset.LockType = adlockoptimistic[hr]
This is the second part of the previeus script:

Code:
ObjRecordset.Source="Select column from Table " ' Exemple of Query'
    
ObjRecordset.ActiveConnection=ObjConnection
ObjRecordset.Open


If ObjRecordset.recordcount>0 then
i = 1                
Do Until ( i > iRowId Or ObjRecordset.EOF )

DataTable("Col" , dtGlobalSheet) = ObjRecordset("Column").Value
DataTable.SetCurrentRow (i)
ObjRecordset.MoveNext

i = i+1
Loop
End if
Remarke : Befor you can use this you have to install oracle ODBC client 10.2 for exemple if oracle database is 10.2 and less