We use the 'Oracle.ManagedDataAccess' ODP.NET driver for database access to Oracle.
When connecting to the database with the connection string:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=10.40.40.38)(Port=1521)))(CONNECT_DATA=(SERVICE_NAME=D3T))); User Id=test; Password=test'
Internal error message:
OracleInternal.NotificationServices.ONSException**: ONS: No node lists have been configured' after opening the connection.
code:
string connect = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=10.40.40.38)(Port=1521)))(CONNECT_DATA=(SERVICE_NAME=D3T))); User Id=test; Password=test";
OracleConnection connection = new OracleConnection(connect);
connection.Open();
The connection to the database is working fine. But what is internally wrong with the configuration?
Thanks to Jacob Peterson.
But if you are unable to find the mentioned setting in C# code then configure your config as below. "Add settings if the block is already there"
<oracle.manageddataaccess.client>
<version number="*">
<settings>
<setting name="LoadBalancing" value="false" />
<setting name="HAEvents" value="false" />
</settings>
</version>
</oracle.manageddataaccess.client>
I found this link helpful: https://www.databaseusers.com/article/6046913/ONS%3A+No+node+lists+were+configured
Basically, you need to configure ONS, or disable LoadBalancing and HAEvents like so:
Oracle.ManagedDataAccess.Client.OracleConfiguration.LoadBalancing = false;
Oracle.ManagedDataAccess.Client.OracleConfiguration.HAEvents = false;
We configure the OracleConnection with a single connection string (without any xml).
Setting those two parameters is possible using the following names, the other parts are for example and not relevant for this problem.
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mydbhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=myservicename)));load balancing=false;ha events=false;Min Pool Size=1;Incr Pool Size=1;user id=mydbuser
I am using ODP.NET Managed Client for years and never saw those OSN exceptions until recent updates when migrating to .NET Core and using Oracle.ManagedDataAccess and Oracle.ManagedDataAccess.Core Nuget packages.
Thanks to Jacob Peterson and other members who suggested to either ignore or disable the both properties "LOAD BALANCING=False;HA Events=False". Each one generates 3 exceptions if enabled on opening connection.
I assume that the new releases suppose that those features are enabled regardless if the server and/or connection string were prepared for that.
So, I suggest to ignore them or append disabled values to the connection string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With