ODP.NET ORA-12154 TNS error only when starting a service

I am writing a service in VB.NET to constantly register data in Oracle DB using ODP.NET

The application was originally written as the basic Windows Forms application and works, however, when I transfer it to the service, it seems that it does not see the TNS file, and the following error message appears:

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

So, using the following connectstring example

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

I get ORA-12154

If I provide a complete TNS record directly to the application, for example

 "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 initially developed the application as a forms application, it worked anyway.

I suggested that maybe the environment variables were set incorrectly, but I added the necessary system variables (ORACLE_HOME / TNS_ADMIN / added the oracle folder in PATH) and it does not work.

The path to which the / service is running was installed that does not contain parentheses, I checked the process using the process monitor, and it looks like it starts with the correct environment variables (ORACLE_HOME / TNS_ADMIN / PATH everything is right there). The machine used for testing runs Win XP

What am I missing here?

thanks

+4
source share
1 answer

I suspect that the user running the service will need file system permission for the entire oracle directory tree. This seems like a permission issue because it cannot resolve the connection identifier, but works if it is not needed.

Try adding read permission for the entire oracle client directory for any user who runs the service.

+1
source

Source: https://habr.com/ru/post/1445066/


All Articles