.netwindows-7oracle9isystem.data.oracleclientora-12154

Oracle9i connection error (ora-12154) in .NET application only on some machines


I made a .NET(4.6.1) application that connects to an Oracle9i Database. This application works fine on the machine I wrote the application on but not on the machine where the application needs to be installed on.

I'm using System.Data.OracleClient. I have no idea what could be wrong. I checked the following things.

Anyone know what else could be the cause of this problem?

Stacktrace of the error:

2017-10-05 16:40:48.7203 - ERROR: System.Data.OracleClient.OracleException (0x80131938): ORA-12154: TNS:servicenaam kon niet worden herleid.

   bij System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc)
   bij System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
   bij System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
   bij System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   bij System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   bij System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   bij System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   bij System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   bij System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   bij System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   bij System.Data.OracleClient.OracleConnection.Open()
   bij QardPrint.Model.Locus.LocusFunctions.AddEmployee(Employee employee, String& errMsg)

Solution

  • I finally "solved" the issue. For some reason the oracle connection did not work on the target machine if my program was installed in the Program Files(x86) folder. However on my development machine it did work in this folder. It's still unclear to me why this is. If anyone knows the reason behind this please leave an answer.