ODP.NET connection pooling: How to tell if a connection has been used

后端 未结 3 1416
礼貌的吻别
礼貌的吻别 2020-12-20 00:17

I\'m modifying a Winforms app to use connection pooling so data access can occur in background threads. The business logic is implemented in PL/SQL and there are a couple of

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 00:57

    If what you need is to just know whether you ever had some connections not come from pool but a fresh new one, I think that you can use the HardConnectsPerSecond and SoftconnectsPerSecond performance counter provided by ODP.NET.

    This won't tell you exactly which OracleConnection.Open() leads to a hard connection, though. I was also thinking about combining other ODP.NET perf counter to determine if a new hard connection is created, but after some experiments this is not easy because ODP.NET will also purge connections every three minutes (depending on the Decr Pool Size setting).

提交回复
热议问题