ora-12154 TNS: could not resolve service name

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
 
M

Miha Markic [MVP C#]

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?
 
N

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.

Nick Moore
 
P

Paul Clement

¤ 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)
 
N

Nick Moore

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top