April 24, 2003 07:24 PM

Swimming in the .NET Connection Pool

Design and configure your .NET connection pool by using common sense, ordinary queries, and a few obscure SqlClient properties
Rating: (0)
SQL Server Magazine
InstantDoc ID #38356
Editor's Note: Portions of this article are adapted from ADO.NET and ADO Examples and Best Practices for VB Programmers, 2nd Edition (Apress, 2002), by William Vaughn.

As an ADO.NET and Visual Basic (VB) instructor and consultant, I often get questions from clients, students, the newsgroups, and list servers about using ADO.NET's connection pools. People ask questions such as:

  • How can I enable and disable the connection pool?
  • How many co...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

It's awesome.

WILLIAM5/24/2007 2:25:27 PM


This means that when running an ASP.NET application, the pages sharing an application domain can share a connection pool—if and only if they have the same transaction context and same connection string. Otherwise, different ASP application domains don’t share pools.

In a Windows environment, each process gets its own set of pools. Two Windows applications with identical connections strings do NOT share a connection pool.

William R. Vaughn
President and Founder
Beta V Corporation
Microsoft MVP
(425) 556-9205 (v/f)

SCone_SQLMag10/15/2004 10:16:50 AM


When author says:
"Also remember that each .NET assembly gets a unique PID. This means that each new assembly you run gets its own pool-regardless of the similarity of function or the fact that their ConnectionString values are identical."
What does he exactly mean? For instance, if I have two assemblies A and B running in the same address space (ASP.NET) and both of them open a DB connection using the same Connection string, does it mean there will be two connection pools created?
Thanks

DIMA10/6/2004 8:12:09 AM


very informative. my pools are over flowing in an asp.net app; while this doesn't tell me really how to fix it, i learned a lot. and will probably be able to figure it out. thanks a lot!

benjamin j, van der veen 7/2/2004 5:00:38 PM


The author didn't go into enough depth(I suspect he didn't do enough research either), and most of the text are just lame assertions. There isn't even a decent sample connection string. Also InvalidOperationException is not thrown when there is connection timeout, it should be SqlException.

csone 6/3/2004 5:46:25 PM


This article is an extremely high quality description, how connection pooling works and what do to avoid pitfalls. Every developer should read it, before using dotnet database providers.

Oliver Hausler 3/27/2004 10:16:46 AM


I presume when Bill says 'If you use a specific UID for each connection, each UID gets its own pool.' he means 'if you use a different UID ...'. Two identical cxn strings used by the same process would get pooled even if they use the same specific UID I thought.

Jim Weiler 5/14/2003 5:37:40 PM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS