Connection Pooling in ADO.NET

Pooling connections can significantly enhance the performance and scalability of your application. Both the SQL Client .NET data provider and the OLE DB .NET data provider automatically pool connections using Windows Component Services and OLE DB session pooling, respectively. The only requirement is that you must use the exact same connection string each time if you want a pooled connection.

ADO.NET now enhances the connection pooling functionality offered in ADO.NET 1.x by enabling you to close all of the connections currently kept alive by the particular managed provider that you are using. You can clear a specific connection pool by using the shared SqlConnection.ClearPool method or clear all of the connection pools in an application domain by using the shared SqlConnection.ClearPools method. Both the SQL Server and Oracle managed providers implement this functionality.

Get Professional Visual Basic 2012 and .NET 4.5 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.