ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Testing  >>  Automation Testing  >>  QTP
 
 


 

 
 WinRunner interview questions  WinRunner Interview Questions
 Load Runner interview questions  Load Runner Interview Questions
 QTP interview questions  QTP Interview Questions
 Test Director interview questions  Test Director Interview Questions
 Rational TestSuite interview questions  Rational TestSuite Interview Questions
 Silk Test interview questions  Silk Test Interview Questions
 Automation Testing AllOther interview questions  Automation Testing AllOther Interview Questions
Question
How to connect to the Database from QTP?
 Question Submitted By :: Srikanth
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to connect to the Database from QTP?
Answer
# 1
connect to database using database checkpoint,database 
output value(connection string is needed)
 
Is This Answer Correct ?    8 Yes 5 No
Francis
 
  Re: How to connect to the Database from QTP?
Answer
# 2
Through scripting this is way to connect the database
Example:-

set conn=Createobject("ADODB.Connection") 
Srvname="Driver={Microsoft ODBC for 
Oracle}:Server=DBserver,UID=Sa,Password=sa" 
conn.open Srvname 
Set Rec = CreateObject("ADODB.Recordset") 
SQL="select * from Users" 
Rec.open SQL ,conn 
Username=Rec.fields("employee name") 
Msgbox Username
 
Is This Answer Correct ?    17 Yes 7 No
Murali Raju
 
 
 
  Re: How to connect to the Database from QTP?
Answer
# 3
Thanks murali...
What is 'ADODB', 'Recordset' and wht we have to give 
in 'Srvname'?
 
Is This Answer Correct ?    3 Yes 5 No
Srikanth
 
  Re: How to connect to the Database from QTP?
Answer
# 4
Microsoft ADO (ActiveX Data Objects) is a Component object 
model object for accessing data sources.The ADO Recordset 
object is used to hold a set of records from a database 
table. A Recordset object consist of records and columns 
(fields).
In ADO, this object is the most important and the one used 
most often to manipulate data from a database.

Srvname is a connection string.if u already installed 
oracle in your system..using that path u can connect oracle 
database...if u dont have oracle give the conncetion string 
path..whatever connection string created used in database 
checkpoint by 
default...Example:DSN=QT_Flight32;DBQ=C:\Program 
Files\Mercury Interactive\QuickTest 
Professional\samples\flight\app\flight32.mdb;Driver=C:\WINDO
WS\system32\odbcjt32.dll;DriverId=281;FIL=MS 
Access;MaxBufferSize=2048;PageTimeout=5;
 
Is This Answer Correct ?    14 Yes 1 No
Murali Raju
 
  Re: How to connect to the Database from QTP?
Answer
# 5
Dim con,rs
set con=createobject("ADODB.Connection")
set rs=createobject("ADODB.Recordset")
con.provider="Microsoft.jet.oledb.4.o"
con.open"Path of the database"
rs.open "select * (table name),con
 
Is This Answer Correct ?    9 Yes 4 No
Manohar
 
  Re: How to connect to the Database from QTP?
Answer
# 6
Thru Self scripting:
set conn=createobject("adodb.connection")
set rs=createobject("adodb.recordset")
' Oracle client is required to be installed on your box
conn.open= "Provider=OraOLEDB.Oracle.1;Password=***;Persist
Security Info=True;User ID=****;SERVER=****;Data
Source=****;DBQ=****;"
sql="your sql"
rs.open sql,conn

rs.close
set rs=nothing

conn.close
set conn=nothing
 
Is This Answer Correct ?    8 Yes 3 No
Ramireddy
 
  Re: How to connect to the Database from QTP?
Answer
# 7
Dim ObjCon, ObjResult, ObjSQL
set ObjCon=Createobject("ADODB.Connection") 
ObjCon.ConnectionString("DSN= ,UID= ,PWD= ")
ObjSQL="SELECT * FROM Emp"
ObjCon.Open()
ObjResult=ObjCon.Execute(ObjSQL)
ObjCon.Close()
ObjResult=Nothing

whtever ur data stored in ObjResult variable
 
Is This Answer Correct ?    9 Yes 1 No
Sandipgami84
 

 
 
 
Other QTP Interview Questions
 
  Question Asked @ Answers
 
how can we group that these test cases only should be automated and in which order you execute that test cases? BSL2
Does QTP recognize two diff browser's at a time..?if possible how..? Is it possible run scripts on Mozilla which are recorded on IE..?..How..? Semantic-Space10
This is Ajay i have few douts if anybody know pls give me reply. 1. i have opend 2 gmails i am working with 1 gmail i want to close other gmail by usig script. 2.i have 10 links in a page all of them have same properties& names i want to click on 5link by using script. 3.i have one combobox in that i want to see all the citynames in the combobox and i have to check weather hyderabad is present or not. 4. size of objectrepository. 5.what r problems we get during writing the script. 6.is it possible to compare to excel sheets in qtp if possible wht is the script. 7.example for lowlevelrecording Symantic-Space2
how to create the varibles and how these are connect to qtp? plz tell me  2
I am trying to write a descriptive program for clicking on a perticular link.For that i wanted an index or location of that object.But when I viewing through spy, There was no index property of that object.What to do for getting index value.How can I get index? please any one let me know.  4
hi Action 1 and action2 if we save it in C:, what folders will be created explain plz iFlex3
what is exact difference between smoke and sanity testing? Satyam6
How can i open 5 multiple browser at once through QTP VB script  2
What is the extension of script and object repositary files? Maveric6
Give me diffrent script in QTP for Webpage(Java and .Net),WindowsBased Applications,Java application,.Net application... Virtusa2
how can you write a script without using GUI in QTP? Ordain-Solutions3
what is the Vbscript to connect Database IBM3
what properties do use to identify a browser and page while using descriptive programming? TCS3
How can we disable popup blocker? (I think it means when we get a pop up messge(its error) how we wil disable that one with out interrupting normal process)  5
difference between multiple parameterization and data driven wizard in QTP?  1
When i use paramateriztion for tickets in flight reservation application , the tes'll run for first iteration but for the second iteration it'll give this details, but the second iteration is failed. Pls anyone clarify it. Cannot find the "Agent Name:" object's parent "Login" (class Dialog). Verify that parent properties match an object currently displayed in your application.  1
for a test in QTP i had choose the object repository as shared.after completion of some days i want to conduct the same test again,now the question is HOW TO LOAD THE OBJECT REPOSITORY. is it possible by descriptive programming.could any one tell me how many ways we load it and what is the process? Logica-CMG12
in flight reservation application. when i entered flyto combobox as london. and i have to check this london is present in flyfrom combobox.give me the code with good explanation. extention to this question. at each iteration i have to put(WRITE) the fly from and fly to city in database table  1
Explain key word driven frame work?How to use in real time? HP2
I want to open a Google page without recording a test and i do not want to use system.Util.run command as well how do i do this? IBM10
 
For more QTP Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com