[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to create a VB6 / Oracle DNS-Less Connection (w/o tnsnames.ora file)

Posted on 2009-04-27
5
Medium Priority
?
1,744 Views
Last Modified: 2013-12-18
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:

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;"

Open in new window

0
Comment
Question by:jrram
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:ajexpert
ID: 24244861
This link should help you
http://www.connectionstrings.com/oracle
 
0
 
LVL 13

Author Comment

by:jrram
ID: 24244940
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.Connection")
Dim oRs: Set oRs = CreateObject("ADODB.Recordset")
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.
0
 
LVL 14

Accepted Solution

by:
ajexpert earned 2000 total points
ID: 24244977
You have to lookin for Oracle Provider for OLEDB while using VB6.
http://www.connectionstrings.com/oracle#16 
Have you tried the following
 

Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=myPort)))(CONNECT_DATA=(SID=MyOracleSID)(SERVER=DEDICATED)));User Id=myUsername;Password=myPassword;

Open in new window

0
 
LVL 13

Author Comment

by:jrram
ID: 24245119
Do you know what the CID parameter stands for?
0
 
LVL 14

Expert Comment

by:ajexpert
ID: 24245168
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
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question