Opened Connections

  • Thread starter Thread starter A.M
  • Start date Start date
A

A.M

Hi,

Even i specificly close the connection at end of my data access function, At
SQL sever's enterprise manager i can see all sessions are being leaved
opened for a while.

If it is connection poolling, why they are not being used? I mean why the
new connection doesn't use one available sessiones in the pool?

Basicly i am surprised ny seeing so many opened sessions from very same
application and very same workstation in Enterprise Manger=>Session Pooling
?

Thanks,
Ali
 
Hi Ali,

Thank you for posting in the community!

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you have got many sessions remain in
the pool after you have closed them explicitly in your code. If there is
any misunderstanding, please feel free to let me know.

As you know, this is caused by connection pooling. When a connection is
opened, a connection pool is created based on an exact matching algorithm
that associates the pool with the connection string in the connection. Each
connection pool is associated with a distinct connection string. When a new
connection is opened, if the connection string is not an exact match to an
existing pool, a new pool is created. So if you have to connection to
different databases on the same server or your connection string is
slightly different from each other, a new pool will be created.

When the connection is closed. It will not be disposed immediately unless
the connection lifetime has expired or the process is ended. Connection
pooling enhanced performance significantly of your application. However,
you can disable it by adding "pooling=false;" in the connection string.

For more information about connection pooling for the .NET Framework data
provider for SQL Server, please check the following link for reference:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconconnectionpoolingforsqlservernetdataprovider.asp

Does this answer your question? If anything is unclear, please feel free to
reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top