jrram
asked on
How to create a VB6 / Oracle DNS-Less Connection (w/o tnsnames.ora file)
Hello all,
I'm trying to figure out how to construct a connection string to connect to an Oracle database w/o using the DNS and also w/o relying on an entry in the tnsnames.ora file.
I tried the tutorial at (http://www.codeproject.com/KB/vbscript/connection_string.aspx), but it isn't working for me.
The error I am receiving is:
"Run-time error '-2147467259 (80004005)
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS could not resolve the connect identifier specified"
Below are the connection strings I've tried:
I'm trying to figure out how to construct a connection string to connect to an Oracle database w/o using the DNS and also w/o relying on an entry in the tnsnames.ora file.
I tried the tutorial at (http://www.codeproject.com/KB/vbscript/connection_string.aspx), but it isn't working for me.
The error I am receiving is:
"Run-time error '-2147467259 (80004005)
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS could not resolve the connect identifier specified"
Below are the connection strings I've tried:
Attempt #1:
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=QA01)(PORT=1521))" & _
"(CONNECT_DATA=(SERVICE_NAME=TEST_DATABASE))); uid=read;pwd=read;"
Attempt #2:
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=QA01)(PORT=1521))" & _
"(CONNECT_DATA=((SID=QA01)(SERVICE_NAME=TEST_DATABASE)))); uid=read;pwd=read;"
ASKER
A couple of other things that will hopefully help with a solution. I am connection using an ADODB Connection. I'm not sure if this matters.
Dim oCon: Set oCon = CreateObject("ADODB.Connec tion")
Dim oRs: Set oRs = CreateObject("ADODB.Record set")
oCon.Open strCon
Database Port: 1521
Database SID: QA01
Database Name: TEST_DATABASE
Database Password: password
>> ajexpert,
The link that you suggested only had a connection w/o tnsnames.ora for VB.NET. I am using VB6.
Dim oCon: Set oCon = CreateObject("ADODB.Connec
Dim oRs: Set oRs = CreateObject("ADODB.Record
oCon.Open strCon
Database Port: 1521
Database SID: QA01
Database Name: TEST_DATABASE
Database Password: password
>> ajexpert,
The link that you suggested only had a connection w/o tnsnames.ora for VB.NET. I am using VB6.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Do you know what the CID parameter stands for?
Here is what you can try:
Open a new VB project put a ADO Data Control on the form and configure its connection string by providing the details required by this. Chose using connection string
After this u would get the required connection string which u can use in your Adodb connection
Open a new VB project put a ADO Data Control on the form and configure its connection string by providing the details required by this. Chose using connection string
After this u would get the required connection string which u can use in your Adodb connection
http://www.connectionstrin