A connection pooling error has occurred

G

Guest

I am trying to clean an object in its Finalize method regarrding connection
pbjects as follows :
objConnection.Dispose()
objConnection = Nothing
shCard = Nothing
The connection iscreated in another object as follows
objConnection = shCard.CreateConnection

I get the following error on the line "objConnection.Dispose() or
objConnection.close
***************************************
{System.InvalidOperationException}
[System.InvalidOperationException]: {System.InvalidOperationException}
HelpLink: Nothing
InnerException: Nothing
Message: "A connection pooling error has occurred."
Source: "System.Data"
StackTrace: " at System.Data.SqlClient.SqlConnection.Close()
at System.Data.SqlClient.SqlConnection.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at ConfigBAL.ShoppingCartDB.Finalize() in
C:\Inetpub\wwwroot\Configurator\Components\ShoppingCartDB.vb:line 977"
TargetSite: {System.Reflection.RuntimeMethodInfo}
*********************************************
Does that mean that I can not close or dispose a connection object because
of pooling
As I said in a previeou post, I have user connections depassing the default,
which I think is 100 by default
Thanks
 
T

Thomas Weingartner

Salam

It seems that you made the same error as described in another post. (Closing/Disposing the method in the destructor). Search for "A connection pooling error has occurred" in google groups and you will find the message.

Good luck
Thomas
 
G

Guest

Thanks, I typed the phrase in google but really just 2 iems dispalyed which
Ithinkare not relevant tothe subject. If you have a URL or msdn item,please
let me know
Thanks again

Thomas Weingartner said:
Salam

It seems that you made the same error as described in another post. (Closing/Disposing the method in the destructor). Search for "A connection pooling error has occurred" in google groups and you will find the message.

Good luck
Thomas

I am trying to clean an object in its Finalize method regarrding connection
pbjects as follows :
objConnection.Dispose()
objConnection = Nothing
shCard = Nothing
The connection iscreated in another object as follows
objConnection = shCard.CreateConnection

I get the following error on the line "objConnection.Dispose() or
objConnection.close
***************************************
{System.InvalidOperationException}
[System.InvalidOperationException]: {System.InvalidOperationException}
HelpLink: Nothing
InnerException: Nothing
Message: "A connection pooling error has occurred."
Source: "System.Data"
StackTrace: " at System.Data.SqlClient.SqlConnection.Close()
at System.Data.SqlClient.SqlConnection.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at ConfigBAL.ShoppingCartDB.Finalize() in
C:\Inetpub\wwwroot\Configurator\Components\ShoppingCartDB.vb:line 977"
TargetSite: {System.Reflection.RuntimeMethodInfo}
*********************************************
Does that mean that I can not close or dispose a connection object because
of pooling
As I said in a previeou post, I have user connections depassing the default,
which I think is 100 by default
Thanks
 
K

Kevin Yu [MSFT]

Hi Salam,

We cannot call Close or Dispose on a Connection, a DataReader, or any other
managed object in the Finalize method of your class. In a finalizer, only
release unmanaged resources that your class owns directly. If your class
does not own any unmanaged resources, do not include a Finalize method in
your class definition.

Actually, you only need to call objConnection.Close when you have finished
using it. The connection object itself will take care of releasing the
unmanaged resources.

For more information, please check the following link:

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

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top