But do we need to distinguish between the physical connection and that
physical connection's state?
If you call close, the physical connection's state becomes closed. Now,
sure you can call open and use it again or the same connection object can be
recycling via pooling, but we're talking about the connection's state here,
not its existance, right?
>>> The conneciton pooling that works by default with asp.net keeps the
>>> conneciton open for a while in case you will need it again.
[quoted text clipped - 10 lines]
> if/when another attempt is made to open a connection w/ the same string,
> that connection is used. This is where the efficiency actually comes from
William (Bill) Vaughn - 31 Jan 2007 00:03 GMT
Ah, no.
When you have the connection pool enabled, when you call Connection.Close,
the physical connection is left open, the Connection.State changes to Closed
and the connection is released to the pool for other code in the same
AppDomain to reuse. The pooling mechanism is fairly complex in some respects
and the 2.0 implementation is very different from the 1.0 or 1.1. For
example, in the 1.1 implementation, if the server goes down or the
connection is closed from the SQL Server end (as when a procedure has a
severe error), your application is notified but the connection remains in
the pool until some other use is attempted. At this point the connection is
dropped. However, since all other connections that use this connection
string might also be bad (as when the server goes down), the application
continues to get errors until all pooled connections are touched.
In the 2.0 version of ADO.NET, when the server goes down, the entire pool is
flushed. You can also clear the pool on demand.
See Chapter 9 for more information.
hth

Signature
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
> But do we need to distinguish between the physical connection and that
> physical connection's state?
[quoted text clipped - 18 lines]
>> if/when another attempt is made to open a connection w/ the same string,
>> that connection is used. This is where the efficiency actually comes from