how we connect oracle or sql data server database to qtp.

Answer Posted / kiran kumar gunda

Kiran Kumar Gunda Mail ID: kiranbec2003@gmail.com

'CONNECTING TO THE CHORDIANT DATABASE - SYMPHONY

'Create the ADO object
Set dbconn = CreateObject("ADODB.Connection") 'connecting
to database by opening the connection string & executing
queries
Set recset = CreateObject("ADODB.Recordset") '
Insert,delete, update..for DML statements
SQLQuery="select * from sym_pduser.branch_information"
'Set the DSN Name
'Environment.Value("DSB_DSN")
="DSN=DEV4;UID=SYM_PDUSER;PWD=userpd0;DBQ=DEV4;DBA=W;APA=T;E
XC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=F;BAM=I
fAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=F;PFC=10;TLO=0;"
Environment.Value("DSB_DSN")
="DSN=CHORD_TEST2;UID=SYM_LDUSER;PWD=userld0;DBQ=CHRDANT_TES
T2 ;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;
GDE=F;FRL=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CS
R=F;FWC=F;FBS=64000;TLO=0;"

'Environment.Value("DSB_DSN")="CHRD_DEV1 =(DESCRIPTION =
(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =
169.185.214.149)(PORT = 1525)))(CONNECT_DATA =(SERVICE_NAME
= chrd0)))"
dbconn.Open Environment.Value("DSB_DSN")
recset.CursorType = 1
'recset.open "select * from
sym_pduser.perf_user_today",dbconn
'dbconn.open
recset.open ""&SQLQuery,dbconn

msgbox "Database Connection Successful"


RecCount=recset.RecordCount
msgbox RecCount

Set RecCount=Nothing
Set recset =Nothing
Set dbconn=Nothing

Creation of DSN String
1) Place the tnsnames.ora file in the
D:\oracle\product\10.1.0\db_1\NETWORK\ADMIN folder
2) Add the Data Source name in the in the System DSN
Go to Control panel -> Administrative Tools ->
Data Sources -> System DSN -> Add
a. Select a Driver for which you want to setup a data
source – Oracle 10g
b. Enter Data source name : CHORD_TEST2
c. Description : Chordiant_Test2
d. Select TNS service name, enter User ID
User Id: SYM_LDUSER
Password: userld0
3) Create a .Udl file and select – select a Provider
Microsoft OLE DB provider for Oracle(Provider for ODBC
Drivers
Click on UDL file and select Connection -> Select use
connection string radio button, click on Build
a) Select machine Data Source
b) Select previously created Data source i.e.,
CHORD_TEST2
c) Enter password, Your Connection string will be
built.
Below is the generated DSN String
DSN=CHORD_TEST2;UID=sym_lduser;PWD=userld0;DBQ=CHRDANT_TEST2
;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GD
E=F;FRL=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=
F;FWC=F;FBS=64000;TLO=0;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is meant by function library?Public and private functions in function library? if private functions are applicable for only for the particular test means then y we have to add those to function library?

1375


What are the advantages of a Hybrid framework?

601


How many ways we can parameterize data in quicktest professional (qtp)?

585


What is the difference between local and shared object repository in qtp?

563


How to use the object spy in quicktest professional 8.0 version?

544






Without using gui map editor we can recognize the application in winrunner ?

605


What is action? How many types of actions are there in qtp?

614


Explain the check points in quicktest professional (qtp)?

557


Hi, my requirement is to make a query in SQL using QTP. And i have to get the results of that query and i have to use those results for future testing. I created a driver but i dont know the code for using this Driver. please help me by providing the solution for y requorement

1647


I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2

1498


I want to configure the OR and library files to a particular QTP test during run time. Note: OR and Library files are located in Quality Center. Is it possible in QTP? Anybody having code?

1372


An action has both shared and local or associated to it and both have the same object in them. In the test which one will be considered?

654


Can you list some technologies that support qtp?

550


can any one please tell me which is the best institute in Bangalore to learn QA (crash course)? Thanks

1525


Hi all, I am using windows vista, I am in the process of learning QTP. When ever I try to work with insert mode in flight application , i am getting the error of 'Operation must use an update table query, fractional truncation(null) error. Can anyone help me regarding this?

1395