I am facing issue to get conneccted with DB2 from UFT 11.53.

553 views
Skip to first unread message

palyam rakesh

unread,
Jul 23, 2014, 10:58:53 PM7/23/14
to mercu...@googlegroups.com
Hi all,

Scenario: My machine is configured with Data Studio client, where my required DB2 data base is configured. Through Data Studio, connection is successful. Here are configuration parameters I am having - Connection, Host, Username, Password, Port, Connection URL.
When connection is established to data base, in the trace view I got to know "Run method as - JDBC".

DB2 details - DB2 for z/OS (V10)

Requirement - I have to make connectivity to DB2 through UFT / QTP.

Queries -
1. Can we make DB2 connectivity with UFT with out installing any drivers / DSN configuration ? If so, based on the configuration parameters I am having, what will be the connection string ?
2. If DB2  connectivity with UFT can be done only with installation of drivers, then which drivers to be installed -  JDBC / ODBC ? (From data studio, connection is through JDBC)
- Could anyone pls share the process to install & configure drivers & connection string that can be used in script.

Thanks in advance !

Ashish Gupta

unread,
Jul 25, 2014, 1:13:35 PM7/25/14
to mercu...@googlegroups.com
hi, you can use following codes ( may be u need to modify a bit)

Set gobjConnectionAs400 = CreateObject("ADODB.Connection")
    gobjConnectionAs400.CommandTimeout= 600
   
    gobjConnectionAs400.ConnectionString = "Driver=iSeries Access ODBC Driver;System="& Environment("DBURL") & ";Uid=" &  Environment("DBUSER") & ";Pwd="&  Environment("DBPASSWORD")   &"; ":gobjConnectionAs400.Open

Thanks,
Ashish gupta
Gurgaon,Haryana


--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shantanu Jain

unread,
Jul 25, 2014, 6:22:12 PM7/25/14
to mercu...@googlegroups.com
Hi Rakesh,
Try this code : 

# first you create the connection string (example is with SQL Server)

Constr = "DRIVER=SQL Server;SERVER=SHANTANU-PC\SQLEXPRESS;UID=SHANTANU;Trusted_Connection=Yes;APP=QuickTest Professional;WSID=SHANTANU-PC;DATABASE=XYZ"
#Establish the connection
Set mycon = createobject("ADODB.connection")
mycon.Open Constr
#Once connection is established, time to play with record set in the DB

Set myrs = createobject("ADODB.recordset")
myrs.Open "select * from location",mycon

Database handling via VBScript is basically done with following steps:
1. Creating the object of ADODB
2. Define the Connection String  for the database to connect
3. Opening the connection
4. Firing of the query
5. Accessing data with Record Set Object
6. Closing the connection
7. Release the memory occupied by the Objects.


Thanks and regards
Shantanu jain
Cell: +91 9611133087

Reply all
Reply to author
Forward
0 new messages