Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 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