Oracle ODP.NET EZ Connect issue in Azure

0

I have a .Net 5.0 API using ODP.NET that is deployed to Azure with a Docker image. It connects to an on-prem Oracle 12.c instance using a hybrid connection. This worked until yesterday, then it started throwing this exception. I cannot pin down any change that could be causing this and would be eternally grateful for pointers.

2021-02-12T23:59:48.562456333Z       Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12154: TNS:could not resolve the connect identifier specified
2021-02-12T23:59:48.562460133Z        ---> OracleInternal.Network.NetworkException (0x00002F7A): ORA-12154: TNS:could not resolve the connect identifier specified
2021-02-12T23:59:48.562464033Z          at OracleInternal.Network.AddressResolution..ctor(String TNSAlias, SqlNetOraConfig SNOConfig, Hashtable ObTnsHT, Hashtable ObLdpHT, String instanceName, ConnectionOption CO)
2021-02-12T23:59:48.562467834Z          at OracleInternal.Network.OracleCommunication.Resolve(String tnsAlias, ConnectionOption& CO)
2021-02-12T23:59:48.562471734Z          at OracleInternal.ConnectionPool.PoolManager`3.ResolveTnsAlias(ConnectionString cs, Object OC)

The app uses the OracleConnectionStringBuilder and EZ Connect syntax. I probably took the following from How to connect Oracle Database to Visual Studio C# project.

OracleConnectionStringBuilder sb = new OracleConnectionStringBuilder
{
    DataSource = _configuration["Oracle_Host"],
    UserID = _configuration["Oracle_User"],
    Password = _configuration["Oracle_Password"]
};

The resulting connection string (taken from a local debug session) looks like this:

{USER ID=username;PASSWORD=apssword;DATA SOURCE=hostname:1521/sid}

There is no Oracle client and no tnsnames.ora on the server.

  • The connection works fine when the app runs locally (where it connects through a VPN tunnel and not an Azure hybrid connection).
  • The connections works from a local or a server-deployed SQLPlus. So it appears that the database or database server are not at fault.
  • Using the latest Oracle.ManagedDataAccess.Core package (2.19.101) from Nuget

The server configuration settings are identical, and I have to assume that it ends up building the same connection string, although I have only verified the individual pieces, not the full connection string. The ADO build pipeline has not changed, the server configuration hasn't, either. There was a deployment but no code changes related to the database connection. A unit test was added.

Someone successfully installed SQL Plus on the blade and connected that way with the same settings, so network connectivity is there.

From the stack trace, it looks like somehow the EZ Connect syntax does not take on the server and it is trying resolve a TNS alias that is not there, but I have no idea why this could happen. Thanks!

oracle
azure
ado.net
azure-hybrid-connections
asked on Stack Overflow Feb 13, 2021 by cdonner • edited Feb 20, 2021 by Jeff

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0