Solved

Get error when accessing Oracle DB from VB program

Posted on 2002-07-25
9
159 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
9 Comments
 
LVL 3

Accepted Solution

by:
PNJ earned 100 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now