VB.NET – ODP.NET ORA-12154 A TNS error occurs only as a service run

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

The application was originally designed as a basic Written in a Windows Forms application, but when I ported it to the service, it seemed to be unable to see the TNS file and threw the following error message:

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

So when using the following example connecttring

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

I got ORA-12154

If I provide the complete TNS entry 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 worked, but when I originally developed the application as a form application, it worked.

I assumed that the environment variables may not be set correctly, but I added the required system variables (ORACLE_HOME / TNS_ADMIN / added the oracle folder to the PATH) and it did not work.

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

What am I missing here?

Thank you

I suspect that the user running the service needs the entire oracle directory tree File system permissions. This feels like a permissions issue because it cannot resolve the connection identifier, but it can work if it is not needed.

Try to add read permissions to the entire oracle client directory, For any user running the service.

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

< /p>

The application was originally written as a basic Windows Forms application, but when I ported it to the service it seemed to be unable to see the TNS file and threw the following error message:

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

So I am using the following Example when connectingtring

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

I got ORA-12154

If I provide the complete TNS entry 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 worked, but when I initially developed the application as The way it works when it forms an application.

I assume that the environment variables may not be set correctly, but I added the required system variables (ORACLE_HOME/TNS_ADMIN/add the oracle folder to the PATH) and it Does not work.

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

What am I missing here?

Thank you

I suspect that the user running the service needs file system permissions for the entire oracle directory tree. This feels like a permissions issue, Because it cannot resolve the connection identifier, but it can work if it is not needed.

Try to add read permissions to the entire oracle client directory for any user running the service.

p>

Leave a Comment

Your email address will not be published.