Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 855711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:07:19+00:00 2026-05-15T08:07:19+00:00

I am trying to determine if I have a database connection leak. So I

  • 0

I am trying to determine if I have a database connection leak.
So I need to see the number of open connections.
I have some simple test code that creates a leak:

protected void Page_Load(object sender, EventArgs e)
{
  for(int i = 0; i < 100; i++)
  {
    SqlConnection sql = new SqlConnection(@"Data Source=.\SQLExpress;UID=sa;PWD=fjg^%kls;Initial Catalog=ABC");
    sql.Open();
  }

}

Note there is no .Close and this does infact crash after being run 3 times in quick succession.

In order to measure the leak I am running the Performance monitor and measuring SQLServer: General Statistics/User Connections:

alt text
(source: yart.com.au)

However, these seem to be zero when I run my code:

alt text
(source: yart.com.au)

What should I change to actually see the connections?

ANSWER

I have approved an answer below. Even though it doesn’t use the performance tools, its good enough for my use. Bottom line is I wanted to see how many connections remain open after opening a web page and this did the trick.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:07:19+00:00Added an answer on May 15, 2026 at 8:07 am

    You can try running a query against the master db like this:

    SELECT SPID,
           STATUS,
           PROGRAM_NAME,
           LOGINAME=RTRIM(LOGINAME),
           HOSTNAME,
           CMD
    FROM  MASTER.DBO.SYSPROCESSES
    WHERE DB_NAME(DBID) = 'TEST' AND DBID != 0 
    

    See this link for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some historical option prices and I'm trying to determine an implied delta.
I’m trying to determine the behaviour of multiple database connection in a distributed transaction.
I have a sports tracker MySQL database and am trying to extract some stats;
I have a unique set-up I am trying to determine if Heroku can accommodate.
I have a layered application. I am trying to determine where to place a
So I am a little confused, I have been looking around trying to determine
I’m trying to determine a good way to handle the scenario below. I have
I have an interesting problem trying to represent complex schedule data in a database.
I've seen some posts dealing with this, and am trying to determine the best
I have a database of user submitted latitude/longitude points and am trying to group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.