Språk

SqlConnection.ClearAllPools Method

Definition

Empties all connection pools.

public:
 static void ClearAllPools();
public static void ClearAllPools();
static member ClearAllPools : unit -> unit
Public Shared Sub ClearAllPools ()

Remarks

ClearAllPools() resets (or empties) all connection pools. If there are connections in use at the time of the call, they are marked appropriately and will be discarded (instead of being returned to a pool) when Close() is called on them.

Caution

Clearing the pool is an expensive operation and should only be used if required. This operation may negatively interfere with pool warmup and generate high connection churn as the warmup operation continually opens new connections to attempt to reach min pool size. This situation is especially likely if clear is called in a tight loop.

Applies to