Home All Groups Group Topic Archive Search About
Author
21 Dec 2006 4:08 PM
sk.rasheedfarhan
Hi, I have troubles with a threaded application on W2003 server. It
seems to leave open connections behind time to time, it sums to
hundreds over a day (the application make thousands). It is using the
SQLOLEDB provider, MDAC 2.82.1830.0, SQL Server 8.00.2039 (SP4),
Windows 5.2 (3790).
   I put two Trace (print) statements : (1) Connection is opened. 2)
Connection is Closed.) I can see the two statements without any
Exception. But the problem is when I see on the Performance viewer
(perfmon.exe/ perfmon.msc->Sqlserver:General Statistics, User
Connections) it shows Number of users  connected to the system is like
thousands and more day by day ,Means the number of open connections are
in Hundreds...thousands and more . I am also loosing the connections
immediately with out any exception.
But still I am seeing open connection.

I am using same connection string. and i written code in C++.

Is there a known bug like this? Is there a way to trace the SQLOLEDB
provider?

Regards,
Rasheeds

Author
21 Dec 2006 4:12 PM
Marina Levit [MVP]
Perhaps connections are being opened elsewhere and that is leaking.

<sk.rasheedfar***@gmail.com> wrote in message
Show quote
news:1166717297.280214.48840@48g2000cwx.googlegroups.com...
> Hi, I have troubles with a threaded application on W2003 server. It
> seems to leave open connections behind time to time, it sums to
> hundreds over a day (the application make thousands). It is using the
> SQLOLEDB provider, MDAC 2.82.1830.0, SQL Server 8.00.2039 (SP4),
> Windows 5.2 (3790).
>   I put two Trace (print) statements : (1) Connection is opened. 2)
> Connection is Closed.) I can see the two statements without any
> Exception. But the problem is when I see on the Performance viewer
> (perfmon.exe/ perfmon.msc->Sqlserver:General Statistics, User
> Connections) it shows Number of users  connected to the system is like
> thousands and more day by day ,Means the number of open connections are
> in Hundreds...thousands and more . I am also loosing the connections
> immediately with out any exception.
> But still I am seeing open connection.
>
> I am using same connection string. and i written code in C++.
>
> Is there a known bug like this? Is there a way to trace the SQLOLEDB
> provider?
>
> Regards,
> Rasheeds
>
Author
21 Dec 2006 4:24 PM
sk.rasheedfarhan
Marina Levit [MVP] wrote:
> Perhaps connections are being opened elsewhere and that is leaking.
>

Hi Marina,
    Connections were closed perfectly because on my machine i am not
finding any leaks but when i am running the same code on client
production machine, i am finding the Connection leak.
   So what can be the reason?
Author
21 Dec 2006 4:34 PM
Marina Levit [MVP]
The client's machine has hundreds of users, when you test on your own
machine it is just the one.  There is not a simple answer as to how to find
the source of the leak, but usually the problem is that some piece of code
is not closing a connection or a datareader.

<sk.rasheedfar***@gmail.com> wrote in message
Show quote
news:1166718261.637001.267970@73g2000cwn.googlegroups.com...
>
> Marina Levit [MVP] wrote:
>> Perhaps connections are being opened elsewhere and that is leaking.
>>
>
> Hi Marina,
>    Connections were closed perfectly because on my machine i am not
> finding any leaks but when i am running the same code on client
> production machine, i am finding the Connection leak.
>   So what can be the reason?
>
Author
21 Dec 2006 5:54 PM
William (Bill) Vaughn
Since this is the ADO.NET list, my questions are as follows:
1) Why use SQLOLEDB? This is only used for COM-based applications--not .NET.
2) Leaking connections are common when the code does not properly dispose of
connections or close them when the application is done with them. For
example, when you have a connection that runs an operation that fails and
the exception handler traps the error, it should also close the connection
if the routine would do so on success.
3) If you were using SqlClient (as you should be) you could track the
connection pool with performance counters.

See Chapter 9.

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

<sk.rasheedfar***@gmail.com> wrote in message
Show quote
news:1166717297.280214.48840@48g2000cwx.googlegroups.com...
> Hi, I have troubles with a threaded application on W2003 server. It
> seems to leave open connections behind time to time, it sums to
> hundreds over a day (the application make thousands). It is using the
> SQLOLEDB provider, MDAC 2.82.1830.0, SQL Server 8.00.2039 (SP4),
> Windows 5.2 (3790).
>   I put two Trace (print) statements : (1) Connection is opened. 2)
> Connection is Closed.) I can see the two statements without any
> Exception. But the problem is when I see on the Performance viewer
> (perfmon.exe/ perfmon.msc->Sqlserver:General Statistics, User
> Connections) it shows Number of users  connected to the system is like
> thousands and more day by day ,Means the number of open connections are
> in Hundreds...thousands and more . I am also loosing the connections
> immediately with out any exception.
> But still I am seeing open connection.
>
> I am using same connection string. and i written code in C++.
>
> Is there a known bug like this? Is there a way to trace the SQLOLEDB
> provider?
>
> Regards,
> Rasheeds
>
Author
24 Dec 2006 12:01 PM
Jesús López
I use the following pattern, and never leaked a connection:

using (DbConnection cn = CreateConnection())
{
    cn.Open();

    // use the connection here

}


Which programming pattern are you using ?

Regards:


Jesús López



<sk.rasheedfar***@gmail.com> escribió en el mensaje
Show quote
news:1166717297.280214.48840@48g2000cwx.googlegroups.com...
> Hi, I have troubles with a threaded application on W2003 server. It
> seems to leave open connections behind time to time, it sums to
> hundreds over a day (the application make thousands). It is using the
> SQLOLEDB provider, MDAC 2.82.1830.0, SQL Server 8.00.2039 (SP4),
> Windows 5.2 (3790).
>   I put two Trace (print) statements : (1) Connection is opened. 2)
> Connection is Closed.) I can see the two statements without any
> Exception. But the problem is when I see on the Performance viewer
> (perfmon.exe/ perfmon.msc->Sqlserver:General Statistics, User
> Connections) it shows Number of users  connected to the system is like
> thousands and more day by day ,Means the number of open connections are
> in Hundreds...thousands and more . I am also loosing the connections
> immediately with out any exception.
> But still I am seeing open connection.
>
> I am using same connection string. and i written code in C++.
>
> Is there a known bug like this? Is there a way to trace the SQLOLEDB
> provider?
>
> Regards,
> Rasheeds
>

AddThis Social Bookmark Button