|
|
|
|
Connecting to Oracle DB via JDBC using QTP
|
|
02-24-2010, 02:35 PM
Post: #1
|
|||
|
|||
|
Connecting to Oracle DB via JDBC using QTP
Hi All I got this complicated question. I tried to connect my DB via QTP. I used the below Script in QTP for connecting and querying DB. Iam gettign this below error in dialog box "[Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error Line (22): "conn1.Open". Note: First I used one host in connection string. Still I got the same error. I also set up "MYDB" datasource in "System DSN" tab on Control Panel -> Administrative Tools ->Data Sources (ODBC) for "Oracle in OraClient10g_home1" driver. I tested the connection after setting uphere and the connection was successful. I am able to connect to MYDB through TOAD application. Please advice me how to correct the script. ****Starting of Script** thisUser = username thisPW = password Environment("CURRENT_SERVICE_NAME" = "MYDB_APP.company.net"sql = "select * from my_table';" ConStr = "Driver={Oracle in OraClient10g_home1}; " & _ "CONNECTSTRING=(DESCRIPTION=" & _ "(ADDRESS = (PROTOCOL = TCP)" & _ "(host = abcn01p.company.net || host = def03v2.company.net)(PORT=1521))" & _ "(CONNECT_DATA=(SERVICE_NAME = " & Environment("CURRENT_SERVICE_NAME&quot & "))); uid=" & thisUser & ";pwd=" & thisPW & ";"Set conn1 = CreateObject("ADODB.Connection" ![]() Set thisObjRS = CreateObject("ADODB.recordset") conn1.ConnectionString = ConStr conn1.Open Set thisObjRS = conn1.Execute(query,,adExecuteNoRecords) varArray = thisObjRS.GetRows ******End of Script*** My TNS.Ora file is exactly same as below. MYDB = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(host = abcn01p.company.net)(port = 1521)) (ADDRESS = (PROTOCOL = TCP)(host = def03v2.company.net)(port = 1521)) ) (CONNECT_DATA = (service_name = MYDB_APP.company.net) ) (source_route = yes) ) |
|||
|
02-24-2010, 04:49 PM
Post: #2
|
|||
|
|||
|
RE: Connecting to Oracle DB via JDBC using QTP
Its better to contact with your DB admin, he will provid you the right details.
|
|||
|
02-24-2010, 07:47 PM
Post: #3
|
|||
|
|||
|
RE: Connecting to Oracle DB via JDBC using QTP
Hi, Thanks for your quick reply.
However I checked with DB Admin and his point was since I am able to connect to My DB via TOAD / SQL TOOLS without facing any problem, he told its not because of TNS.Ora file which leaves me with one option ie, the connection string in QTP. So I checked an alternative way like creating a dB check point. The connection was successful. But the string was bit lengthy. I replaced this string in my script. Now the connection opened successfully. But I got this below error. "Command text was not set for the command object. Line (30): "Set thisObjRS = conn1.Execute(query,,adExecuteNoRecords)". " Can Someone please guide me how to first get rid of this above error and then how to correct my Connection string. First aim is to successfully connect to DB.
|
|||
|
02-25-2010, 10:45 AM
Post: #4
|
|||
|
|||
|
RE: Connecting to Oracle DB via JDBC using QTP
I am not able to understand your connection string, there are so many
![]() connection string to connect to oracle should be - Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword; the way I use in my script is Code: Set ConObj = CreateObject("ADODB.Connection")try this, hope it helps. Thanks, ~Saket Kumar [Linkedin][pdf Api for QTP] It's so hard when I have to, and so easy when I want to... |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| Connection string for oracle (Remote DB) in QTP | rohit330 | 1 | 499 |
02-23-2012 07:53 PM Last Post: rohit330 |
|
| QTP Oracle and Java add-ins issue | navitha | 7 | 2,500 |
07-29-2010 11:55 PM Last Post: supputuri |
|
| Connecting MQ to QTP through VBScript | Priya.Shah134 | 0 | 1,058 |
05-22-2010 03:33 PM Last Post: Priya.Shah134 |
|
| Connecting Linux machine from QTP | gauri | 0 | 769 |
02-18-2010 03:51 PM Last Post: gauri |
|
| Calling a Oracle Stored Procedure from QTP. | geethwind | 3 | 2,170 |
08-14-2009 11:23 AM Last Post: prasadsbrk |
|
User(s) browsing this thread: 1 Guest(s)
|
|

Search
Member List
Calendar
Help


= "MYDB_APP.company.net"
