Hi,
We have a .net core application which we are running on a dotnet core docker container. It is trying to connect to an oracle server, but we are getting a NULL REFERENCE exception on connection.open()
Exception Message: Object reference not set to an instance of an object.
Exception Source: Oracle.ManagedDataAccess
Exception Stack:
at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, OracleConnection connRefForCriteria, String instanceName, List`1 switchFailedInstNames)
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 VmAgent.SideCar.Oracle.Services.OracleEngineHealth.<Ping>d__3.MoveNext()
When we run the application locally in Visual Studio (on Windows) we do not get the null exception, but it does not work inside the container.
This is the code snippet:
using (var connection = new OracleConnection(connectionString))
{
using (var command = new OracleCommand("SELECT STATUS from v$instance", connection))
{
command.Connection.Open();
var reader = await command.ExecuteReaderAsync();
if (await reader.ReadAsync())
{
return Convert.ToString(reader["STATUS"]) == "OPEN";
}
}
}
I do know that it is able to reach the server as when I disable port 1521 on my server I get error "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor". After I enabled 1521 I started getting this error.
Am I missing some docker configuration that I need to set?
Any help would be really appreciated.
Thanks