I am using the following code to open two tables:
<% @Language="VBSCRIPT"%>
<!-- #include virtual="/include/db.inc" -->
<%
' DATABASE ONE
Dim objConnection1,rs11
GetSegmentConnect1 = "ODBC;UID=abcdba;PWD=abcdb
a;DSN=abc;
"
set objconnection1 = OpenConnection(GetSegmentC
onnect1)
sql11 = "select * from table_x"
set rs11 = ExecSql (sql11,ObjConnection1)
response.write rs11(0)
rs11.close
'DATABASE TWO
Dim objConnection,rs
GetSegmentConnect = "ODBC;UID=XYZDBA;PWD=XYZDB
A;DSN=XYZ;
"
set objconnection = OpenConnection(GetSegmentC
onnect)
sql = "select count(wo) from table_y"
set rs1 = ExecSql (sql,ObjConnection)
response.write rs1(0)
%>
the openConnection function is as follows:
function OpenConnection(byval s_Connect)
'
' This function will connect to a database
' and then return the DB object.
dim objConn
set objConn = CreateObject("ADODB.Connec
tion")
objConn.ConnectionString = s_Connect
objConn.ConnectionTimeout = 30
objConn.Open
set OpenConnection = objConn
end function
The ExecSql function is as follows:
function ExecSQL(byval s_SQL, byref objConn)
'
'this function will execute a SQL statement and then
'return the recordset.
'
dim rs
set rs = nothing
' A trace line
on error resume next
Set rs = objConn.Execute(s_SQL)
set ExecSQL = rs
end function
My problem is I can open only one table either DATABASE ONE or DATABASE TWO. If try to open both table i got the following error.
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Oracle][ODBC Oracle Driver][Oracle OCI]ORA-12505: TNS:listener could not resolve SID given in connect descriptor.
How to solve it. help me
Start Free Trial