Home All Groups Group Topic Archive Search About

Sql server express 2005 connections open

Author
11 Oct 2006 5:28 AM
steve
Hi All

I have a VB.net 2005 application which uses Sql server express 2005

When I read or write data to sql server I always close the connection immediately after finishing using...
---------------------------------------------------
If Not IsNothing(con) Then

con.Dispose()

con = Nothing

End If

-----------------------------------------------------

When I go into Sql server management studio to detach the database etc there is usually always at least 2 open connections showing in the studio

Close cursor on commit = false

autoclose = false

What am I missing??

Regards

Steve

Author
11 Oct 2006 7:47 AM
Kevin Yu [MSFT]
Hi Steve,

This might be caused by connection pooling. If pooling is enabled, when you
call close() on a connection, the connection to the database is actually
not closed. It was just returned to the pool. This is used to improve
performance if your app is frequently opening and closing connections.

The connections will be closed completely if you close your app. You can
also disable pooling by adding "pooling=false" in your connection string.

If anything is unclear, please feel free to let me know.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
11 Oct 2006 10:10 AM
steve
Hi Kevin

Thanks for the info, spot on as usual

Regards
Steve

Show quoteHide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:0FLLAmQ7GHA.2336@TK2MSFTNGXA01.phx.gbl...
> Hi Steve,
>
> This might be caused by connection pooling. If pooling is enabled, when
> you
> call close() on a connection, the connection to the database is actually
> not closed. It was just returned to the pool. This is used to improve
> performance if your app is frequently opening and closing connections.
>
> The connections will be closed completely if you close your app. You can
> also disable pooling by adding "pooling=false" in your connection string.
>
> If anything is unclear, please feel free to let me know.
>
> Kevin Yu
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
12 Oct 2006 6:06 AM
Kevin Yu [MSFT]
Hi Steve,

If the connection pooling info does not resolved your issue, please feel
free to let me know.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
11 Oct 2006 10:34 AM
Oenone
Kevin Yu [MSFT] wrote:
> The connections will be closed completely if you close your app. You
> can also disable pooling by adding "pooling=false" in your connection
> string.

Additionally, if you're using VB2005, you can call the
SqlClient.SqlConnection.ClearAllPools() method to clear the connection pool
on demand.

--

(O)enone