skip to main content
Using the ADO.NET Client : Using Connection Pooling : Adding Connections to a Pool
 

Adding Connections to a Pool

A connection pool is created in the process of creating each unique connection string that an application uses. When a pool is created, it is populated with enough connections to satisfy the minimum pool size requirement, set by the Min Pool Size connection string option. If an application is using more connections than Min Pool Size, the data provider allocates additional connections to the pool up to the value of the Max Pool Size connection string option, which sets the maximum number of connections in the pool.
When a OpenAccessConnection object is requested by the application calling the Connection.Open(…) method, the connection is obtained from the pool, if a usable connection is available. A usable connection is defined as a connection that is not currently in use by another valid OpenAccessConnection object and has a valid link to the server.
If the maximum pool size has been reached and no usable connection is available, the request is queued in the data provider. The ADO.NET Client waits for the value of the Connection Timeout connection string option for a usable connection to return to the application. If this time period expires and no connection has become available, then the ADO.NET Client returns an error to the application.
Important: Closing the connection using the Close() or Dispose() method of the Connection object adds or returns the connection to the pool. When the application uses the Close method, the connection string settings remain as they were before the Open was called. If you use the Dispose method to close the connection, the connection string settings are cleared, and the default settings are restored.