4

I am writing a service in VB.NET to continually log data to an Oracle DB using ODP.NET

The application was originally written as a basic Windows Forms App and works however when I port it to a service it seems it cannot see the TNS file and the following error message is thrown:

Service cannot be started. Oracle.DataAccess.Client.OracleException
ORA-12154:TNS:could not resolve the connect identifier specified    

So when using the following example connectstring

"Data Source= example;User Id= user;Password=password;"

I get ORA-12154

If I provide the full TNS entry directly to the app e.g

"Data Source= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = EXAMPLE)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = EXAMPLE) ) );User Id= user;Password=password;"

Then it works but when I originally developed the app as a Forms Application it worked either way.

I assumed maybe the environment variables were not set up correctly but I have added the required system variables (ORACLE_HOME / TNS_ADMIN / added the oracle folder to PATH) and it doesnt work.

The path the service is being run/was installed from does not contain parentheses, I have checked the process with process monitor and it looks like it is being started up with the correct environment variables (ORACLE_HOME / TNS_ADMIN / PATH are all there and correct). The machine being used for testing is running Win XP

What am I missing here?

Thanks

Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
user1671538
  • 163
  • 1
  • 4
  • 13

1 Answers1

1

I suspect that the user that the service runs as will need file system permission to the entire oracle directory tree. This feels like a permissions problem, since it can't resolve the connect identifier, but works if it doesn't need to.

Try adding read permission to the entire oracle client directory for whatever user that the service is running as.

Lynn Crumbling
  • 12,985
  • 8
  • 57
  • 95
  • The issue was that the TNS file I was using was on a network share (ifile=//etc) and the service didnt have the required permissions to that share as it was started under a local user account. Thanks – user1671538 Nov 09 '12 at 14:51
  • @user1671538 Terrific - so my suspicion/answer (this is a permissions problem) ended up being true? – Lynn Crumbling Nov 09 '12 at 15:07