Solved

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

Posted on 2004-08-25
5
688 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 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