Our application uses managed ODP.NET code to call a variety of Oracle Procedures.
For one of our clients, who is using public database links, and referencing the linked tables within the procedure, that call is failing. Upon further testing, any attempt to run a query via ODP.NET to the linked table fails.
ORA-12154: TNS: could not resolve the connect identifier specified
Full Stack:
Oracle.ManagedDataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution(OracleConnectionImpl connectionImpl, Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, Boolean isDescribeOnly, Boolean isFromEF)
at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at [APPLICATION CODE]
This is strange because attempts to use SQL PLUS to make the same queries succeed, even though there is no TNS Names ora file on the client machine.
Our app does not even use TNS-Names, it uses explicit connection string details.
We've even run test queries through the DevArt oracle driver and they are also successful.
It's as though specifically making the calls via Managed ODP.NET makes the server treat the Database link differently.
ODP.NET Query (Client Machine A) > (Server A) > Table (Server B) = ERROR
SQL Plus Query (Client Machine A) > (Server A) > Table (Server B) = SUCCESS
DEV ART Query (Client Machine A) > (Server A) > Table (Server B) = SUCCESS
The test query we're using now is a simple SELECT statement
Does anyone know how we can make ODP.NET defer to the server for this information the same way SQL Plus does?
DB Link Information:
OWNER: PUBLIC
USERNAME: [FIXED OTHER USER]
Our client was able to fix this problem on the server side. The issue was the format of the DB Link.
Original DB Link:
Apparently over ODP.NET, the TNS Names Reference is insufficient. Once the client switched to a full connection detail, the issue was resolved.
Updated DB Link:
More details here:
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm