ora-12154 TNS: could not resolve service name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

H

I'm able to connect to my Oracle d/b through the VS.NET IDE in C# but when I build the app and try to run it outside the IDE, I get the dreaded ora-12154 message. I've checked my tnsnames.ora file (tnsping uses it ok) and it looks ok. I've seen a couple of people reporting being able to connect in VB.NET but not in C#

Anybody got any ideas

Nick Moor
 
Hi Nick,

Nick Moore said:
Hi

I'm able to connect to my Oracle d/b through the VS.NET IDE in C# but when
I build the app and try to run it outside the IDE, I get the dreaded
ora-12154 message. I've checked my tnsnames.ora file (tnsping uses it ok)
and it looks ok. I've seen a couple of people reporting being able to
connect in VB.NET but not in C#.

There is no difference between vb.net and C# in problems like this.
You are probably using different connect string outside ide.
Can you show us some code?
 
Hi

The connect string is hard coded at the moment and looks like this,

connHiMS = new System.Data.OracleClient.OracleConnection();
connHiMS.ConnectionString = "Data Source=NEWHIMS;User
Id=structures;Password=babtie;";

It connects to the d/b fine when running in the IDE but if I 'Release'
build it and install it on my m/c, it fails to connect.

Nick Moore
 
¤ Hi
¤
¤ The connect string is hard coded at the moment and looks like this,
¤
¤ connHiMS = new System.Data.OracleClient.OracleConnection();
¤ connHiMS.ConnectionString = "Data Source=NEWHIMS;User
¤ Id=structures;Password=babtie;";
¤
¤ It connects to the d/b fine when running in the IDE but if I 'Release'
¤ build it and install it on my m/c, it fails to connect.

What happens if you run it straight from the Release folder under Bin?

So far I haven't been able to repro the error. Are you running the app under the same NT account as
when you're running it from within the IDE?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Hi Paul

I have to thank you for pointing me in the right direction. The .exe in
the Release folder does run ok, I hadn't tried that.

It turns out to be the VS.NET Installer (I think) that's causing the
problem. I had created a deployment project within my solution and used
that to install the app on my development machine and another machine
for testing purposes. If I do this, I get the Oracle connecetion error.
If I just copy the contents of the Release folder, all is well.

Thanks again for your help.

Nick Moore
 
Back
Top