Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exception on first connection attempt (successful thereafter)

3771747Aug 29 2018 — edited Dec 20 2018

I'm running a dotnet core 2.1 application running under the microsoft/dotnet:2.1-runtime Docker image; the application runs simple select queries against an Oracle 11.2g database; I've tried this using Oracle.ManagedDataAccess.Core 2.12.0-beta2 and beta3.

The (simplified) code below will throw an exception when calling OpenAsync() for the first time; each subsequent call works as expected.

using (var conn = new OracleConnection("User ID=super;Password=password;Data Source=1.2.3.4:1525/service:dedicated;")

{

  await conn.OpenAsync();

}

The exception is below.

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): Oracle Communication: Failed to connect to server or failed to parse connect string ---> OracleInternal.Network.NetworkException (0x80004005): Oracle Communication: Failed to connect to server or failed to parse connect string ---> System.NullReferenceException: Object reference not set to an instance of an object.

   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)

   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)

   at OracleInternal.I18N.Conv.GetInstance(Int32 charsetId)

   at OracleInternal.Network.ConnectPacket..ctor(SessionContext sessCtx)

   at OracleInternal.Network.OracleCommunication.SendConnectPacketAndProcessResponse(AddressResolution addrRes)

   at OracleInternal.Network.OracleCommunication.DoConnect(String tnsDescriptor)

   at OracleInternal.Network.OracleCommunication.DoConnect(String tnsDescriptor)

   at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession, OracleConnection connRefForCriteria, String instanceName)

   at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)

   at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)

   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, OracleConnection connRefForCriteria)

   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()

   at System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)

I have trace files from the application however I don't know what I'm looking for in them.

Any pointers would be appreciated.

This post has been answered by Alex Keh-Oracle on Dec 20 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2019
Added on Aug 29 2018
6 comments
2,652 views