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!

Object Referenced Not Set to an instance of an Object (in docker only)

Ryan SitesMar 20 2019 — edited May 1 2020

I am using Nuget Package Oracle.ManagedDataAccess.Core 2.18.5 in a Asp.Net Core web api. I am able to run fine locally from both Windows and Mac machine.

Inside my docker image however, I am unable to connect to Oracle database.

I keep getting the following stack trace :

Error occured while calling  PR CreateNewPR(Int32, Boolean, OracleInternal.ConnectionPool.ConnectionString, Oracle.ManagedDataAccess.Client.OracleConnection, System.String, System.Collections.Generic.List`1[System.String]) Details : Object reference not set to an instance of an object.", "exception": "System.NullReferenceException: Object reference not set to an instance of an object.\n   at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, OracleConnection connRefForCriteria, String instanceName, List`1 switchFailedInstNames)\n   at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)\n   at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)\n   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, OracleConnection connRefForCriteria)\n   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()

My docker image is using the microsoft base image

FROM microsoft/dotnet:2.1-aspnetcore-runtime

Connection string is as follows

ConnectionString = $"User Id={oracleUsername};Password={oraclePassword};Data Source= (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 1.2.3.4)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ServiceName))); ";

Fails on line 3

OracleConnection connection = new OracleConnection();

connection.ConnectionString = ConnectionString;

connection.Open();

Any and all help would be appreciated. Again, only happens from within docker image, and I am using latest version of nuget package!

This post has been answered by Alex Keh-Oracle on May 1 2020
Jump to Answer
Comments
Post Details
Added on Mar 20 2019
17 comments
8,999 views