Connection Pooling in .NET Applications

View PDF

Connecting to a database is the single slowest operation performed by a data-centric application. This document describes how reusing pooled connections, instead of creating new connections, can improve .NET application performance.

You can control connection pooling behavior by using the connection string options set for your ADO.NET data provider. For example, connection string options can define the following settings for the DataDirect Connect® for ADO.NET data providers:

  • Number of connection pools (Max Number of Pools)
  • Maximum connection pool size (Max Pool Size)
  • Minimum number of connections in a connection pool (Min Pool Size)
  • Number of seconds to keep connections in a connection pool (Connection Lifetime)
  • Whether to enable Windows Integration authentication for the SQL Server data provider (Integrated Security)

This document also describes the performance advantages of DataDirect's technique of handling dead connections in a connection pool, as well as tips on opening and closing connections. In addition, C# code examples illustrate how to create connection pools and how to handle distributed transactions when using a connection pool.

NOTE: Code examples in this document use the ADO.NET 2.0 Common Programming Model and MetaData capabilities introduced in the Microsoft .NET 2.0 Framework. If you are using the .NET Framework 1.x or DataDirect Connect for .NET 2.2 data providers, refer to Connection Pooling in .NET Applications.

ADO.NET Connection Pooling Topics: (Click to view topic.)

Ready to try DataDirect Connect for ADO.NET?
| Learn More
Ready to try DataDirect Connect for ADO.NET?