Solved

Get error when accessing Oracle DB from VB program

Posted on 2002-07-25
9
163 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

679 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