Solved

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

Posted on 2004-08-25
5
678 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
  • 2
5 Comments
 
LVL 2

Expert Comment

by:lmpsteelwire
Comment Utility
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
Comment Utility
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
Comment Utility
excellent
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
Comment Utility
Submitted to PAQ with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

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

Join & Write a Comment

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…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

12 Experts available now in Live!

Get 1:1 Help Now