What .NET 2.0 Has in Store for ADO.NET, Page 2
Connection Pool Control
Not all of the providers support connection pooling. The SQL Server and Oracle providers do. There was previously no way to programmatically clear the pool of open connections. The upcoming release of ADO.NET will include the ability to clear the connection pool in the SqlClient and OracleClient providers through static methods on the corresponding connection objects.
Connection Pool Control Sample Code
The following sample code demonstrates the use of the static methods to clear the connection pools:
// Clear all the poolsSystem.Data.SqlClient.SqlConnection.ClearAllPools();// Clear a specific poolSqlConnection dbconn = new SqlConnection();dbconn.ConnectionString = ConfigurationSettings.AppSettings.Get("ConnectionString");SqlConnection.ClearPool(dbconn);
You may want to examine many more new additions in ADO.NET 2.0 than the ones covered here. You'll find a number of additional articles that may serve your research. The following links on related topics will get you started:
- Work with XML Data Type in SQL Server 2005 from ADO.NET 2.0
- Want to Execute Multiple Queries on a Single Connection? Go to MARS
- What's New in ADO.NET 2.0 for SQL Developers
The next column has yet to be determined. If you have something in particular that you would like to see explained, please e-mail me at firstname.lastname@example.org.
About the Author
Mark Strawmyer, MCSD, MCSE, MCDBA is a Senior Architect of .NET applications for large and mid-size organizations. Mark is a technology leader with Crowe Chizek in Indianapolis, Indiana. He specializes in architecture, design, and development of Microsoft-based solutions. Mark was honored to be named a Microsoft MVP for application development with C# for the second year in a row. You can reach Mark at email@example.com.