PDA

View Full Version : "ORA-12154: TNS:could not resolve service name" with Oracle Data Provider f


Chris
01-05-2004, 02:55 PM
I have installed Oracle Data Provider for .NET (9.2.0.4.0) and am
trying to make a simple connection to a database. I can test connect
fine with the Net Manager and have verified that my TNSNames.ora and
SQLNET.ora files are non-duplicated. I am assuming that they are
correct as I saved my configuration in Net Manager after testing the
connection successfully.

However, when attempting to connect from C#, I get an excpetion with
the error:
"ORA-12154: TNS:could not resolve service name"

Same thing happens also when trying to use
System.Data.OleDb.OleDbConnection as well.

Can anyone steer me in the right direction of where to look first?

--
Thanks,
Chris Simmons

Chris
01-06-2004, 07:18 AM
newsgroup.replies@netchris.com (Chris) wrote in message news:<20094607.0401051455.287c7e57@posting.google.com>... I have installed Oracle Data Provider for .NET (9.2.0.4.0) and am trying to make a simple connection to a database. I can test connect fine with the Net Manager and have verified that my TNSNames.ora and SQLNET.ora files are non-duplicated. I am assuming that they are correct as I saved my configuration in Net Manager after testing the connection successfully. However, when attempting to connect from C#, I get an excpetion with the error: "ORA-12154: TNS:could not resolve service name" Same thing happens also when trying to use System.Data.OleDb.OleDbConnection as well. Can anyone steer me in the right direction of where to look first?

Looks like I can't get anything programmatic to hook up. I can test
fine from NetManager and from testing a DSN in ODBC Data Sources
(DSN). However, when I try to access the data source from C#, I am
always getting 12154. This is with OdbcConnection, OleDbConnection,
and OracleConnection. All of them. I'm stumped.

Chris
01-06-2004, 08:24 AM
newsgroup.replies@netchris.com (Chris) wrote in message news:<20094607.0401051455.287c7e57@posting.google.com>... I have installed Oracle Data Provider for .NET (9.2.0.4.0) and am trying to make a simple connection to a database. I can test connect fine with the Net Manager and have verified that my TNSNames.ora and SQLNET.ora files are non-duplicated. I am assuming that they are correct as I saved my configuration in Net Manager after testing the connection successfully. However, when attempting to connect from C#, I get an excpetion with the error: "ORA-12154: TNS:could not resolve service name" Same thing happens also when trying to use System.Data.OleDb.OleDbConnection as well. Can anyone steer me in the right direction of where to look first?

OK, now I have a little more info on this. This issue only arises
when debugging in VS.NET. When stepping through code, at the
connection.Open() method call, the error occurs. However, when the
executable is run without being debugged, it runs fine. Is this
documented?

Chris
01-07-2004, 08:35 PM
On 5 Jan 2004 14:55:40 -0800, newsgroup.replies@netchris.com (Chris)
wrote:
I have installed Oracle Data Provider for .NET (9.2.0.4.0) and amtrying to make a simple connection to a database. I can test connectfine with the Net Manager and have verified that my TNSNames.ora andSQLNET.ora files are non-duplicated. I am assuming that they arecorrect as I saved my configuration in Net Manager after testing theconnection successfully.However, when attempting to connect from C#, I get an excpetion withthe error:"ORA-12154: TNS:could not resolve service name"Same thing happens also when trying to useSystem.Data.OleDb.OleDbConnection as well.Can anyone steer me in the right direction of where to look first?

OK, more info. The path where my project lies (and therefore the
bin\Debug directory is within a directory with parentheses in the name
(e.g. "C:\My Documents\VS.NET Projects
(1.1)\Something\Here\bin\Debug"). Is this documented? It appears
that ODP.NET will not resolve a service name in this directory. Place
the test .exe in "C:\My Documents\VS.NET
Projects\Something\Here\bin\Debug" (no parens) and the connection goes
fine.

--
Thanks,
Chris Simmons
forensics@christophersimmons.org

*** IMPORTANT - DO NOT REPLY TO ABOVE E-MAIL ADDRESS ***
It exists solely as bait for spam. If you wish to e-mail
me (and have me actually READ your e-mail), use the address
listed in the From: header.

Jeff
01-08-2004, 06:18 AM
I have quite a lot of difficulty with this myself, but only with the IDE--
I usually have to reconfig the data adapter (without any real changes) to get
connections to start working and then they're usually fine until I restart the
IDE. My apps, however, never have a problem making the connection.

In article <0bnpvvcuvmifkjlcbo2v6sfo18417rv3ic@4ax.com>, Chris Simmons
<newsgroup.replies@netchris.com> wrote:On 5 Jan 2004 14:55:40 -0800, newsgroup.replies@netchris.com (Chris)wrote:I have installed Oracle Data Provider for .NET (9.2.0.4.0) and amtrying to make a simple connection to a database. I can test connectfine with the Net Manager and have verified that my TNSNames.ora andSQLNET.ora files are non-duplicated. I am assuming that they arecorrect as I saved my configuration in Net Manager after testing theconnection successfully.However, when attempting to connect from C#, I get an excpetion withthe error:"ORA-12154: TNS:could not resolve service name"Same thing happens also when trying to useSystem.Data.OleDb.OleDbConnection as well.Can anyone steer me in the right direction of where to look first?OK, more info. The path where my project lies (and therefore thebin\Debug directory is within a directory with parentheses in the name(e.g. "C:\My Documents\VS.NET Projects(1.1)\Something\Here\bin\Debug"). Is this documented? It appearsthat ODP.NET will not resolve a service name in this directory. Placethe test .exe in "C:\My Documents\VS.NETProjects\Something\Here\bin\Debug" (no parens) and the connection goesfine.

jharri
01-24-2004, 06:35 AM
I have the exact same scenario, except that I am calling Oracle from
web service. When i test the connection from my local machine it work
fine in a .Net windows application. When i test the connection fro
the server using VBScript or VB6 executable, it works fine. But fro
the .Net web service, it keeps giving ORA-12154. I have tried Oracl
.Net Managed Provider from Microsoft, and OleDB, and both return th
same error. The web service is in a folder with no parenthesis. An
it doesn't work even compiled. So the experiences listed above do no
apply in my case. Ideas welcome.

Jeff wrote: *I have quite a lot of difficulty with this myself, but only with th IDE-- I usually have to reconfig the data adapter (without any rea changes) to get connections to start working and then they're usually fine until restart the IDE. My apps, however, never have a problem making the connection. In article <0bnpvvcuvmifkjlcbo2v6sfo18417rv3ic@4ax.com>, Chri Simmons <newsgroup.replies@netchris.com> wrote:On 5 Jan 2004 14:55:40 -0800, newsgroup.replies@netchris.co (Chris)wrote:OK, more info. The path where my project lies (and therefore thebin\Debug directory is within a directory with parentheses in th name(e.g. "C:\My Documents\VS.NET Projects(1.1)\Something\Here\bin\Debug"). Is this documented? It appearsthat ODP.NET will not resolve a service name in this directory. Placethe test .exe in "C:\My Documents\VS.NETProjects\Something\Here\bin\Debug" (no parens) and the connectio goesfine.

jharr
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message247123.htm

Daniel Morgan
01-24-2004, 06:39 AM
jharri wrote: I have the exact same scenario, except that I am calling Oracle from a web service. When i test the connection from my local machine it works fine in a .Net windows application. When i test the connection from the server using VBScript or VB6 executable, it works fine. But from the .Net web service, it keeps giving ORA-12154. I have tried Oracle Net Managed Provider from Microsoft, and OleDB, and both return the same error. The web service is in a folder with no parenthesis. And it doesn't work even compiled. So the experiences listed above do not apply in my case. Ideas welcome.

Post the following four files:

1. SQLNET.ORA
2. TNSNAMES.ORA ... just the part with this specific instance if the TNS
has more than one
3. The value of the environment variables ORACLE_HOME and ORACLE_SID as
viewed from your application (meaning verify their values from .NET)
4. The part of your code used to connect (not too verbose)

--
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service