Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database connection - TNS error
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hi ,

I am getting TNS protocol error when i try to connect to Oracle database.Please any one help me to resolve this issue

I am using below code,


Code:
Public Function Action_Open_Oracle_Database_Connection(sDbHost,sDbSID,sDbUserName,sDbUserPassword,sDbProtocol,sDbPort,sQuery,FieldName)
   'Creates a DB connection object and opens the connection

                                Set  DB_CONNECTION=CreateObject("ADODB.Connection")
                               sConnection_String = "Driver={Oracle in OraClient11g_home1}; " &_
                                "CONNECTSTRING=(DESCRIPTION=" &_
                                "(ADDRESS=(PROTOCOL=" & sDbProtocol & ")"&_
                                "(HOST="& sDbHost &")(PORT=" & sDbPort & "))"&_
                                "(CONNECT_DATA=(SID=" & sDbSID & "))); uid=" & sDbUserName & ";pwd=" & sDbUserPassword & ";"

                                DB_CONNECTION.Open sConnection_String

                                'Action_Open_Oracle_Database_Connection = DB_CONNECTION

set Record_Set1=DB_CONNECTION.Execute(sQuery)
row_value1 = Record_Set1.FIELDS(FieldName)

''Rec.open sQuery ,conn
'
'UN= Rec.fields(FieldName)
msgbox row_value1
End Function


Attached Files Image(s)
   
Reply


Messages In This Thread
Database connection - TNS error - by Shwetha - 05-20-2011, 08:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connection to oracle using JDBC and QTP dileep45 0 3,309 07-30-2013, 06:39 PM
Last Post: dileep45
Question DB connection string issue jackmartins 2 5,824 07-05-2013, 02:47 PM
Last Post: Staff
  Remote Database connection through QTP PrabhatN 4 7,620 12-02-2010, 12:53 PM
Last Post: cdesserich
  mapping database user to database kamalteja 4 4,491 11-03-2010, 11:58 AM
Last Post: kamalteja
  jboss console connection debo 0 1,881 05-15-2008, 06:42 PM
Last Post: debo

Forum Jump:


Users browsing this thread: 2 Guest(s)