Highlighted
Absent Member.
Absent Member.
2237 views

Integrate Oracle DB

Hi,

Can Anyone help me connect an oracle DB?

Given only username, password, sid and host with read only access.

Also I'm new in Oracle odbc. 

I can't ifnd a detailed guide on this one. 

Thanks!

Tags (1)
0 Likes
2 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: Integrate Oracle DB

Hi,

 

First of all, in order to connect to an Oracle database you would have to install the Oracle client (I would recommend the 32-bit version because QTP/UFT is a 32-bit application).

Then, all you would have to do is define a connection string and create the database connection. An example using the Microsoft ODBC for Oracle :

Dim HOST, PORT, SID, USER, PASSWORD, dbConnection
HOST = "db_host"
PORT = "db_port"
SID = "db_sid"
USER = "db_user"
PASSWORD = "db_pass"
Srvname = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST="& HOST &")(PORT="& PORT &"))" & _
"(CONNECT_DATA=(SID="& SID &"))); uid="& USER &";pwd="& PASSWORD &";"

Dim dbConnection 
Set dbConnection = CreateObject("ADODB.Connection") 
dbConnection.Open Srvname

 'Test the connectivity state 
if dbConnection.state = 1 then 
    msgbox "Succes !" 
    else 
    msgbox "Fail !" 
End If

 

Hope this helps.

 

Accept as solution and give kudos to the author if the information helped you solve your problem.
Highlighted
Absent Member.
Absent Member.

Re: Integrate Oracle DB

Hi Mihai,

Your solution works!

 

Thanks!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.