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

后端 未结 3 1417
礼貌的吻别
礼貌的吻别 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:58

    ADO.NET manages a connection pool for you. It's even configurable. Why would you ever try to track these connections yourself?

    http://msdn.microsoft.com/en-us/library/bb399543.aspx

    And, specifically for Oracle:

    http://msdn.microsoft.com/en-us/library/ms254502.aspx

    The .NET Framework Data Provider for Oracle provides connection pooling automatically for your ADO.NET client application. You can also supply several connection string modifiers to control connection pooling behavior (see "Controlling Connection Pooling with Connection String Keywords," later in this topic).

    Pool Creation and Assignment

    When a connection is opened, a connection pool is created based on an exact matching algorithm that associates the pool with the connection string in the connection. Each connection pool is associated with a distinct connection string. When a new connection is opened, if the connection string is not an exact match to an existing pool, a new pool is created.

    Once created, connection pools are not destroyed until the active process ends. Maintaining inactive or empty pools uses very few system resources.

    BTW, I guess I'm not totally hip on all the OracleClient changes that have been going on. It seems like Microsoft may be dropping support? Last I knew ODP.NET was based on ADO.NET... but, even if I'm mistaken about that, ODB.NET claims to support connection pooling out of the box as well:

    http://download.oracle.com/docs/html/E10927_01/featConnecting.htm#CJAFIDDC

提交回复
热议问题