ODP.NET 23c — Major Dev Release Update

Alex Keh
Oracle Developers
Published in
5 min readApr 2, 2024

Last year, Oracle delivered the first ODP.NET 23c developer release with a whole host of innovative features. We have updated that release with more enhancements in the 23.3.2 version of ODP.NET Core and managed ODP.NET. Let’s explore what’s new.

.NET Metrics

One of the most requested features from the ODP.NET developer community is .NET Metrics. They are application measurements collected at regular intervals for monitoring and app health alert purposes. With the 23.3.2 release, you can now monitor ODP.NET connection statistics, such as number of ODP.NET hard and soft database connections, active connections, free connections, and more.

Because ODP.NET is integrated with the .NET Metrics framework and OpenTelemetry, these connection stats can be published to and analyzed by the rich and expansive third-party tool sets available, such as Grafana and Prometheus, as well as the standard .NET Metrics APIs and tools.

To enable metrics instrumentation, developers associate the metric name Oracle.ManagedDataAccess.Core for ODP.NET Core or Oracle.ManagedDataAccess for managed ODP.NET with the MeterListener Meter.Name property. The MeterListener class can subscribe in-process to ODP.NET metrics counters. For out-of-process subscriptions, use the .NET EventSource class.

Learn more about ODP.NET Metrics.

OpenTelemetry — Dynamic and Automatic Instrumentation

ODP.NET adds OpenTelemetry dynamic and automatic instrumentation capabilities to the existing tracing options. ODP.NET dynamic instrumentation allows applications to turn on and off tracing at runtime. This option targets where tracing is needed to save disk space, limit unnecessary overhead, and make troubleshooting easier with a smaller trace to review. Automatic instrumentation enables ODP.NET OpenTelemetry tracing without requiring code changes. Existing apps can turn on tracing without having to recompile.

Let’s first discuss dynamic instrumentation. It’s easy to enable and disable tracing at runtime. Let’s say you have enabled ODP.NET Core OpenTelemetry via AddSource.

Sdk.CreateTracerProviderBuilder()
.AddSource("Oracle.ManagedDataAccess.Core")
.AddConsoleExporter()
.Build();

To dynamically disable ODP.NET OpenTelemetry tracing at runtime, set OracleConfiguration.OpenTelemetryTracing to false. To enable it again, set it to true(default). It’s as simple as that to turn off and on tracing.

Now, there are times you want to enable tracing without rebuilding the app or modifying the source code. That’s when automatic instrumentation can help. You turn on tracing by default or via environment variables. The following environment variable settings show how to enable ODP.NET Core tracing using the console exporter.

OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES=Oracle.ManagedDataAccess.Core
OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED=true

As long as you have added a recent version of the OpenTelemetry.AutoInstrumentation NuGet package to your app, you can use ODP.NET automatic instrumentation.

The OpenTelemetry project team has a PR to fully enable ODP.NET auto instrumentation in an upcoming OpenTelemetry release. I’ll let you know the version when it becomes available.

Learn more about ODP.NET OpenTelemetry.

Centralized Configuration Providers — Cloud Vaults and Ease of Use

ODP.NET 23c can store and retrieve application configuration data from a centralized and secure on-premises, cloud (IaaS), Oracle Cloud Infrastructure (PaaS), or Azure (PaaS) location using the new centralized configuration providers. The providers can contain ODP.NET connection strings and tuning parameters.

Centralized application configuration makes managing and cloning ODP.NET configuration simpler throughout the application development lifecycle. It suits modern architectures, such as microservices and serverless deployments.

The new 23.3.2 dev release adds more capabilities to the existing providers. Here’s a description of the additional features.

  • Cloud vault storage

Passwords, wallets, and tokens are sensitive database information that can now be stored in Azure Key Vault or OCI Vault services as secret. ODP.NET provides a secured way to store and access this sensitive information in these vaults using a predefined URL.

  • Connection URL caching and automatic updates

Since it takes longer retrieving connection information from a cloud resource than local disk, ODP.NET can now cache connection information locally to facilitate faster connection times. When that connection information changes in the cloud, local cache updates can occur using either a polling or change notification model.

The polling model uses the config_time_to_live key. This property sets the duration in seconds for ODP.NET to keep the same connection information cached. When the cache expires, ODP.NET retrieves the connection information from the remote configuration provider again and refreshes the cache.

In contract, the change notification model provides real time connection information updates. When data on the cloud is modified, ODP.NET receives the notification almost immediately instead of waiting for config_time_to_live to expire. The relevant cache entries are evicted, and the latest values are retrieved the next time they are needed.

Note: Connection URL change notifications are only available for Azure App Configuration at this time. Change notification support for more cloud services will be available soon.

  • Automatic password refresh

Administrators often set up password expiration policies so that passwords become invalid at a regular cadence and replaced with new ones. For existing connection pools, this can result in ORA-01017 errors (invalid username/password; logon denied) and having to rebuild the connection pool manually for each refresh.

ODP.NET has added the ability to automatically refresh the existing connection pool with the new password. This feature eliminates end users experiencing connection errors and forcing apps to rebuild their pool after each password refresh using the centralized configuration providers.

Learn more about ODP.NET Centralized Configuration Providers.

Mutual TLS/SSL Certificate Selection

ODP.NET now allows selecting a specific Transport Layer Security/Secure Sockets Layer (TLS/SSL) certificate stored in the Microsoft Certificate Store wallet location via a graphical user interface or thumbprint. The selected key is cached so that it doesn’t have to be re-selected on subsequent connection attempts.

To enable the graphical interface selection, set the OracleConnection AllowCertificateSelectionUI property to true. The end user can then choose their certificate from the store before opening their database connection. If you want to programmatically supply the certificate thumbprint instead, populate the SSLCertificateThumbprint property with the thumbprint value.

Learn more about ODP.NET Mutual TLS/SSL Certificate Selection.

Faster Connection Establishment

ODP.NET 23.3.2 connection establishment has been optimized to reduce the number of database round trips required when connecting with Oracle Database 23c and higher. Applications that upgrade experience this performance improvement transparently without any code changes needed.

We’re Not Done Yet

The Oracle team is wrapping up the Oracle Database 23c release in preparation of shipping the production version. We have delivered a plethora of major features already, but are saving the best for last. When 23c goes out, you’ll see cool advancements around around artificial intelligence (AI) and vector data types (and even a new name). 😉

.NET developers can use these new innovations via ODP.NET, of course.

Stay tuned!

In the meantime, try out the new ODP.NET 23.3.2 features by downloading either ODP.NET Core or managed ODP.NET. You can read more about other new data provider features in the ODP.NET 23c documentation.

--

--

Alex Keh
Oracle Developers

Alex Keh is a senior principal product manager at Oracle focusing on data access and database integration with .NET, Windows, and the cloud.