?
Solved

Get error when accessing Oracle DB from VB program

Posted on 2002-07-25
9
Medium Priority
?
168 Views
Last Modified: 2010-05-02

1)  I installed Oracle 8.0 on a server.

2)  I tested connectivity to a databse through the Oracle tools. I made a connection. The DB name is EPA1.

3) I have a VB program which accesses the same databse. When running the program I get the following message:

"TNS could not resolve service name"  
How can I connect via Oracle but not using VB?

Is it a driver issue?  Please help.



0
Comment
Question by:FidelMike
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 3

Accepted Solution

by:
PNJ earned 400 total points
ID: 7177238
Have you set up the service (Eg MyService) using "Net8 Easy Config"? Then you connect along the lines of (Eg using ADO):

   Set gadoConnect = New ADODB.Connection
   gadoConnect.ConnectionString = "Extended Properties=""" & _
   "Driver=MyService;" & _
   "UID=USERNAME;PWD=PASSWORD;" & _
   "ConnectString=MyService;"""
   gadoConnect.ConnectionTimeout = 30
   gadoConnect.CursorLocation = adUseServer
   gadoConnect.Open , , , adConnectUnspecified
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7177241
Have you set up the service (Eg MyService) using "Net8 Easy Config"? Then you connect along the lines of (Eg using ADO):

   Set gadoConnect = New ADODB.Connection
   gadoConnect.ConnectionString = "Extended Properties=""" & _
   "Driver=MyService;" & _
   "UID=USERNAME;PWD=PASSWORD;" & _
   "ConnectString=MyService;"""
   gadoConnect.ConnectionTimeout = 30
   gadoConnect.CursorLocation = adUseServer
   gadoConnect.Open , , , adConnectUnspecified
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7177245
damn it. Double-clicked "Submit" - sorry.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Expert Comment

by:damienm
ID: 7177311
You should have a file called Tnsnames.ora inside c:\orant\net80\admin, the data source you supplied in VB should be inside this file if not it will give this error.
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7177315
...isn't that what "Easy Config" does for you? :-)
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7177550
FidelMike,

If you are not expierenced with messing with the tnsnames.ora stick with PNJ's solution.  You can run into numerous problems if you mess with the file.

Net 8 Easy config is you best bet.

Ed.
0
 

Expert Comment

by:paulll
ID: 7180762
I assume Oracle client is installed for the client PC for the Oracle version you need to access.

If an Oracle database is not set up with Oracle client install, search your orant/network/admin directory for "tnsnames.ora" (path may vary)

You need an entry such as:
EPA1 =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = server.orabox.com)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = EPA1)
   )
 )

DESCRIPTION, ADDRESS_LIST and CONNECT_DATA do not need to be filled in.

Where "EPA1" is the server name.
server.orabox.com is the address refecting the IP address, you must know the address.
1521 is the PORT, you must know the port.



Private ConDB As ADODB.Connection
Private ProviderType, User As String, UserPassword As String

ProviderType = "Provider=OraOLEDB.Oracle" & User & UserPassword & ";Data Source=EPA1;DistribTx=0"
ConDB.Open ProviderType

Make sure you have rights to the database for the user & password.

Paul
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8040626
Hi FidelMike,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept PNJ's comment(s) as an answer.

FidelMike, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8095669
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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