4 Replies Latest reply on Feb 20, 2020 9:02 AM by user5543674

    ODP.Net Core - Connection Pool details




      I have an application, using the latest ODP.NET Core and need to get information about the current number of active connections in the pool. The reason for that is that I need to monitor the number of active connections and, if threshold exeeded, restart the application.


      Right now, the only way I see to get that information from the ODP.NET is to let it write performance counters and then read the written information. Is there any other possibility to get that information within the application? It would be nice to have a static getter method for that.

        • 1. Re: ODP.Net Core - Connection Pool details
          Alex Keh - Product Manager-Oracle

          You can use the PerformanceCounter class in the System.Diagnostics namespace to have your app consume the counters info directly. This is generic to all performance counters,

          • 2. Re: ODP.Net Core - Connection Pool details

            Hi Alex,

            ok, as the Oracle client is writing optionally into performance counters, I can setup the oracle client to write those and then read afterwards. However, it would be nice, if I could read the values directly from the client within my application as this would be more easy and stable. Performance counters needs to be created first and then application users must be setup to be able to access those.

            • 3. Re: ODP.Net Core - Connection Pool details
              Alex Keh - Product Manager-Oracle

              It's not clear why an ODP.NET custom implementation would be easier and more stable. The ADO.NET PerformanceCounter class is well-known and stable. Maybe there are ways to make it easier to use. However, there would be a learning curve. All .NET developers that work programmatically with performance counters are familiar with using the PerformanceCounter class. Developers would find it easier to repurpose existing code that pulled performance counters from another source that to develop all new ODP.NET-specific performance counter code. Plus, they wouldn't be able to use these ODP.NET APIs with all the Windows and third-party tools that already plug into the PerformanceCounter class.

              • 4. Re: ODP.Net Core - Connection Pool details

                I was thinking of a CurrentConnectionPool that is just exposing the current data as read properties so its accessible like below in addition to the already existing way with performance counters. This change would be transparent to users already making use of Performace Counters.


                var connection = new OracleConnection();

                connection.ConnectionString = "Data Source=Oracle";