Home » Infrastructure » Windows » ORA-12154 in web app vs console app
ORA-12154 in web app vs console app [message #332813] Wed, 09 July 2008 15:40 Go to next message
aozm
Messages: 6
Registered: February 2008
Junior Member
I am trying to connect to an Oracle database in a Visual Studio/C# web application. I can connect to several databases fine, but when trying to connect to a particular one, I get the following error:

ORA-12154: TNS:could not resolve service name

I have checked my connection string information and am sure it's correct. The exact same code works fine in a console applications. But for some reason, I get the error in a web app.

Any thoughts on what the difference between the types of application might be with regards to the error I am getting? What can I look into to try to fix this?

Thanks!

Re: ORA-12154 in web app vs console app [message #332815 is a reply to message #332813] Wed, 09 July 2008 15:48 Go to previous messageGo to next message
ThomasG
Messages: 3101
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Set both up that they use the same name resolution.

Most likely they use different tnsnames.ora / sqlnet.ora files in different ORACLE_HOMEs at the moment.

Re: ORA-12154 in web app vs console app [message #332820 is a reply to message #332815] Wed, 09 July 2008 16:27 Go to previous messageGo to next message
aozm
Messages: 6
Registered: February 2008
Junior Member
How do I know what tnsnames files they're using? I forgot to mention - I'm running both locally, on my computer - neither of these apps is on a server. So, shouldn't the tnsnames files be the same?
Re: ORA-12154 in web app vs console app [message #332823 is a reply to message #332820] Wed, 09 July 2008 17:08 Go to previous messageGo to next message
ThomasG
Messages: 3101
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Quote:

So, shouldn't the tnsnames files be the same?



Yes/No/Maybe.

One application runs in your session, the other runs with the user of the webserver, if it's a web app.

Having layers of Visual Studio jammed in the middle that use a possible third set of configurations makes it even harder to figure out what executable uses which one. Have you searched on the disk yet if you HAVE multiple ones somewhere?

Re: ORA-12154 in web app vs console app [message #332824 is a reply to message #332823] Wed, 09 July 2008 17:30 Go to previous messageGo to next message
aozm
Messages: 6
Registered: February 2008
Junior Member
I just searched my local drive and have two copies of each file (tnsnames and sqlnet) but the second ones are in the sample directory.

I guess I'm just not familiar enough with Oracle to even know where to begin looking. My local tnsnames file does not have any information in it regarding the servers I've been connecting to. It just looks like a template file that can be modified if needed. So, does this mean that the console app is looking elsewhere, other than my machine? Or even the web app for that matter...some of the connections work - where is it getting that information? Does all the connection information have to be in a tnsfile *somewhere*? Or is it possible that I can be connecting to Oracle in my C# app, just based on the connection information in my config file?

Sorry if these sound like stupid questions - like I said, I'm not that familiar with Oracle - all the connections I've needed so far have just worked so I didn't need to dig into the hows and whys any further.
Re: ORA-12154 in web app vs console app [message #332827 is a reply to message #332824] Wed, 09 July 2008 17:54 Go to previous messageGo to next message
ThomasG
Messages: 3101
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Well, first you would have to figure out what naming sheme is atually in use when you say that there are no entries in the tnsnames.ora files

the four that COULD be used are

- Local Naming (tnsnames.ora)
- Oracle Directory Naming
- Oracle Host Naming
- NIS Naming

I suggest you have a look at the Oracle Net Services Troubleshooting Guide, especially this paragraph
Re: ORA-12154 in web app vs console app [message #333156 is a reply to message #332827] Thu, 10 July 2008 11:08 Go to previous message
aozm
Messages: 6
Registered: February 2008
Junior Member
With the help of the DBA/Architect here, I verified that my tnsnames file being referenced should have been on the server and not my local one. I am not familiar with the difference between Oracle Directory Naming vs Oracle Host Naming vs NIS Naming. But what we did was go to my registry and see the value of the directory in the Oracle\HOME0 path. It was a server \\TNSHOME\TNSNAMES$, which I then browsed out to and looked at the tnsnames file there. It had the same information I had been putting with regards to the database I couldn't connect to.

In the meantime, I had even renamed my local tnsnames files to make sure it shouldn't have been used. I could connect to all the databases fine, except the one that I had been having difficulty with all along.

Then, I finally copied the information from the \\TNSHOME\TNSNAMES$ file and put it in my local file and that worked. So...while I can connect to the database now, I am still confused as to a few things:

I still don't know why there is a difference between a web app vs console/windows app. If my registry settings pointed to the server, shouldn't the web app have been looking there to?

Even if my web app was looking at the local file all along, why did every other database connection I was using work? Either all should have worked or none at all.

Previous Topic: hardware requirement for Oracle 10 G database on windows 2003
Next Topic: DIM-00014
Goto Forum:
  


Current Time: Fri Oct 24 18:11:48 CDT 2014

Total time taken to generate the page: 0.19744 seconds