473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

COM components referenced in asp.net leave SQL connections open

ben
I am having problems with old COM components that I must use in my
ASP.NET project leavings connections open in the SQL server "Process
Info" with "AWAITING COMMAND".

After some testing I have determined that .NET is not correctly
calling the Class_Terminate in the old COM componet which would close
the connection.

I have tested this with my own API and found that I must expose a
method that allows me to manually clos the SQL connection, so just
before I set the object to nothing I call the .CloseDBConn() - this
works.

The problems is that the APIs I am using are written by third-party
software vendors so I cannot modify them.

I have read that the Garbage Collector is supposed to get rid of these
connections but it doesn't appear to. With every refresh of the
browser so another connection (or two) is born, hundreds will appear
and never disappear.

Hope someone can shed some light on this.
Nov 18 '05 #1
2 892
The .NET is not releasing COM object until garbage collector collects the wrapper for COM object.

And you never know when this is going to happen.
So you should do exactly the same thing as you do with database connection, file object, ....

Implicitly release it when you need it to be released

Here is how
System.Runtime.InteropServices.Marshal.ReleaseComO bject (objMyComObject);

George
My Site - Body Jewelry
"ben" <be********@btinternet.com> wrote in message news:be**************************@posting.google.c om...
I am having problems with old COM components that I must use in my
ASP.NET project leavings connections open in the SQL server "Process
Info" with "AWAITING COMMAND".

After some testing I have determined that .NET is not correctly
calling the Class_Terminate in the old COM componet which would close
the connection.

I have tested this with my own API and found that I must expose a
method that allows me to manually clos the SQL connection, so just
before I set the object to nothing I call the .CloseDBConn() - this
works.

The problems is that the APIs I am using are written by third-party
software vendors so I cannot modify them.

I have read that the Garbage Collector is supposed to get rid of these
connections but it doesn't appear to. With every refresh of the
browser so another connection (or two) is born, hundreds will appear
and never disappear.

Hope someone can shed some light on this.
Nov 18 '05 #2
ben
This worked perfectly, many many thanks. I am amazed it is not better
publicised.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
3
by: Joanny | last post by:
Hi, there, When I open a VB6 application on VB.net, it automatically upgrade to VB.net. But I got the error message said: "Upgrade failed: Exception occurred: The referenced components...
3
by: Anthony | last post by:
Hey all, Here's a question for you, my hosts have told me that that one my pages, php, was causing their server to reboot because there were too many open connections and that they should be...
4
by: Angelos | last post by:
I get this error mysql_pconnect Too many connections ... every now and then. Does anyone knows where it comes from ? There are a lot of sites running on the server and all of them use the...
17
by: Peter Proost | last post by:
Hi Group, I've got an interesting problem, I don't know if this is the right group but I think so because everything I've read about it so far says it's a .net problem. Here's the problem, we're...
4
by: mescano | last post by:
I am currently implementing a singleton pattern for accessing a database. Is it advisable to close the connection to the database at all -- thus leaving it open or should it be closed. If closed,...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
6
by: Steve Ricketts | last post by:
I have a webservice written in VB.net that opens a connection to SQL Server 2000 with a connection string. The connection remains open for the life of the web service so the ADODB.connection is...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.