How to connect the database through QTP

Showing Answers 1 - 7 of 7 Answers

ganesh

  • Jul 22nd, 2006
 

Hi

if you know the "connection string" of your server and also the username, password and DNS name you can connect to the server.

these details are required at the time of creating the Database check point.

Thanks

Ganesh

  Was this answer useful?  Yes

ganesh

  • Jul 22nd, 2006
 

Hi kotesh

to connect to the database through QTP we must know the connection string of the server we are going to connect, after that connection string, you must provide the username, password and DNS name to connect to the database

fater doing this only you can create the database check point in your application

plz correct me if i am wrong

Thanks

Ganesh

  Was this answer useful?  Yes

Hokrani

  • Jul 25th, 2006
 

How to do "connection string to the server" ? Can u explain me more detail. It would be gr8 if u provide me step do to it.

  Was this answer useful?  Yes

Ganesh TS

  • Jul 26th, 2006
 

Hiwhen u create a database check points for the script which u have recorded, there u have to specify the "connection string" to connect to the databasefor creating the connection string these are the stepsStep :1first of all add ur DSN in ur datasource of ur OSgo to control pannel -> administrative tools -> ODBC source -> click the button ADD and select the database type like u want to connect to oracle or mysql or MS access.....specify your DSN name and test the connection is established or not after giving the proper service name, username and password If u want to create the connection string for the flight application then "Step 1" is not necessarythere will be default DSN will be created ( at the time of installing the QTP) in the name "Flight 32" under the coulmn "Data Source name"Step 2: Select the DB check point option in the QTP application "Database query window" will be displayedstep 3: Select the option "Specify the SQL stmt manually"Step 4: select the DSN for which u want to create the DB Connection enter the "Username", Password and SID name of ur database.step 5:After ur username and password authenticated the connection string will automatically populated in the Connection String area of the DB Query wizard window.if u have still more queries write into tsgee29@gmail.com - Ganesh TS

  Was this answer useful?  Yes

suresh0249

  • Aug 9th, 2006
 

Hi,

To connect data base first we must have to create a DSN,after creating a DSN connect through a SQL query.

  Was this answer useful?  Yes

Uday Kumar. A

  • Sep 28th, 2006
 

Here is the sample code to access the resultant values in a DB:

connStr="driver=sql server;server=ServerName;database=DBName;uid=sa;pwd=sa"
sqlQry="select stdname from studentdetails"
Dim cmdObj,rsObj
Set cmdObj=createobject("adodb.command")
Set rsObj=createobject("adodb.recordset")
cmdObj.activeconnection=connStr
cmdObj.commandtext=sqlQry
Set rsObj=cmdObj.execute
While not rsObj.EOF
 studentname=rsObj.fields("stdname") 'Give different parameter names if u retrieve more than one column
 msgbox(studentname)
 rsObj.movenext
Wend

  Was this answer useful?  Yes

sudhakar2068

  • Oct 23rd, 2006
 

Here is the sample code to access the resultant values in a DB:

connStr="driver=sql server;server=ServerName;database=DBName;uid=sa;pwd=sa"
sqlQry="select stdname from studentdetails"
Dim cmdObj,rsObj
Set cmdObj=createobject("adodb.command")
Set rsObj=createobject("adodb.recordset")
cmdObj.activeconnection=connStr
cmdObj.commandtext=sqlQry
Set rsObj=cmdObj.execute
While not rsObj.EOF
 studentname=rsObj.fields("stdname") 'Give different parameter names if u retrieve more than one column
 msgbox(studentname)
 rsObj.movenext
Wend

sudhakar kolla,

My email:kollasudhakar2005@yahoo.co.in.

My number:09819859346


 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions