Hi,

Despite somme reading (including doc, Reflector, etc.), i dont't really
understand wich is the best method between Close and Dispose (or perhaps
the both) to get pooling with SQL Server with a well defined connection
string ?

If any body have some idea or a good pattern to close a connection ?

Best regards
Gilles


*** Sent via Developersdex http://www.developersdex.com ***

RE: Connection poolling by KerryMoorman

KerryMoorman
Mon Jul 14 10:20:00 CDT 2008

Gilles,

Close, Dispose and Using are functionally equivalent ways of closing the
connection.

With the .net data provider for SQL Server, connection pooling is managed
automatically so nothing additional should need to be done by you.

In what way is connection pooling not working for you?

Kerry Moorman


"Gilles Nambert" wrote:

> Hi,
>
> Despite somme reading (including doc, Reflector, etc.), i dont't really
> understand wich is the best method between Close and Dispose (or perhaps
> the both) to get pooling with SQL Server with a well defined connection
> string ?
>
> If any body have some idea or a good pattern to close a connection ?
>
> Best regards
> Gilles
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

Re: Connection poolling by William

William
Mon Jul 14 12:23:13 CDT 2008

Consider that the ADO.NET Connection objects are simply "connectiods" to
pooled connections which are maintained by the provider's connection pooling
mechanism (CPM). When they are closed (or disposed) the connection pool
"connection" is simply marked as "reusable" and a timer starts. If another
request for the same connection string is passed to the provider, the oldest
resuable connection is reactivated. If 4-8 minutes passes without another
request the connection is physically closed by the CPM.

The need for pooling really varies based on the architecture of your
application. Lots of perfectly functional Windows Forms applications
(especially those that want to manage server-side state on their own) don't
pool at all. ASP or similar application live and die based on how well the
pool is managed.

See Chapter 9 of my book.

"Gilles Nambert" <gntools@hotmail.fr> wrote in message
news:uMWSA5Y5IHA.5052@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> Despite somme reading (including doc, Reflector, etc.), i dont't really
> understand wich is the best method between Close and Dispose (or perhaps
> the both) to get pooling with SQL Server with a well defined connection
> string ?
>
> If any body have some idea or a good pattern to close a connection ?
>
> Best regards
> Gilles
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________