Solved

VB.NET connection to Oracle using System.Data.OracleClient.dll

Posted on 2004-08-25
5
689 Views
Last Modified: 2008-01-09
I am trying to connect to an Oracle database but I keep getting the following error message:

ORA-12154: TNS:could not resolve service name
at System.Data.OracleClient.DBObjectPool.GetObject(Object owningObject, Boolean& isInTransaction) at System.Data.OracleClient.OracleConnectionPoolManager.GetPooledConnection(String encryptedConnectionString, OracleConnectionString options, OracleConnection owningObject, Boolean& isInTransaction) at System.Data.OracleClient.OracleConnection.OpenInternal(OracleConnectionString parsedConnectionString, Object transact) at System.Data.OracleClient.OracleConnection.Open() at EntMont.ls_test.BindData() in c:\inetpub\wwwroot\EntMont\ls_test.aspx.vb:line 51

I am running this on my local host.  
I can connect to the database using SQL+.
I have given the ASPNET user rights to the Ora81 directory which contains the subdirectories with the TNSNAMES.ORA.
I have added a reference in my project to the System.Data.OracleClient.
The connection string I am using contains the User ID, Data Source, and Password.

Any help would be greatly appreciated.

Thanks,
Matt
0
Comment
Question by:mattclip
[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
  • 2
5 Comments
 
LVL 2

Expert Comment

by:lmpsteelwire
ID: 11893246
mimic this:

dfwConn is my oracleclient connection

fill in the 3 spots

            strCn = "Data Source=DATABASE;User Id=USER;Password=PASS;Integrated Security=no;"
            dfwConn = New OracleConnection
            dfwConn.ConnectionString = strCn
            dfwConn.Open()
0
 

Author Comment

by:mattclip
ID: 11893599
Found my problem.  I was using the wrong value for the Data Source.  I am used to using SQL Server so I put the IP address in for the datasource, but with Oracle you need to put the TNS name that you used in the TNSNAMES.ORA file.  Note: TNS name must be 16 characters or less.
0
 
LVL 2

Expert Comment

by:lmpsteelwire
ID: 11893689
excellent
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 12143284
Submitted to PAQ with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 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