I have some weird issue on some client machines getting database connection.
In my code I add the connection string as an OracleDataSources, define my OracleCredential and instantiate a new OracleConnection by calling new OracleConnection(connectionString, credentials).
The whole thing works fine, but for some user the attempt to create the connection fails with:
OracleInternal.Network.NetworkException (0x00002F7A): ORA-12154: TNS:could not resolve the connect identifier specified
at OracleInternal.Network.AddressResolution..ctor(String TNSAlias, SqlNetOraConfig SNOConfig, Hashtable ObTnsHT, Hashtable ObLdpHT, String instanceName, ConnectionOption CO)
at OracleInternal.Network.OracleCommunication.Resolve(String tnsAlias, ConnectionOption& CO)
at OracleInternal.ConnectionPool.PoolManager`3.ResolveTnsAlias(ConnectionString cs, Object OC)
at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession, OracleConnection connRefForCriteria, String instanceName)
There are several things that bother me.
- TNS is used! It might sound strange, but the connection string added to the OracleDataSources is fully qualified and there should be no need to use TNS in the first place.
- When I use tnsping <alias> is there a successful connection within 10 ms, using sqlplus <username>/<password>@<alias> works fine as well and a connection is established
I am using Oracle.ManagedDataAccess in version 21.3.0, however for some clients it works for some it doesn't.
Any suggestions what to do, where to look for the error?