Solved

Connection pooling

Posted on 2004-11-01
270 Views
Last Modified: 2012-05-05
I'm using C# & ASP.NET. When i create a loop/refresh page ... after 99 times i get

"Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. "

So my connection pool is full, but how can this be ?!  I created an empty page and only used these 2 code snippets. What am i doing wrong.

SqlDataAdapter oDataAdapter = new SqlDataAdapter("select * from users",
                                    "user id=sa;password=xxx;Initial Catalog=xxx;Data Source=(local)");
 
                              DataSet oDataSet = new DataSet();
                              oDataAdapter.Fill(oDataSet);
                              oDataAdapter.Dispose();
---------------------------------------------------
for(int i =0;i<105;i++)
                  {
                        using (SqlConnection oConn = new SqlConnection("user id=sa;password=xxx;Initial Catalog=xxx;Data Source=(local)"))
                        {
                              SqlCommand oCommand = new SqlCommand("select * from users");
                              oCommand.Connection = oConn;
                              oConn.Open();
                              try
                              {
                                    oCommand.ExecuteNonQuery();
                              }
                              finally
                              {
                                    oConn.Close();
                              }
                        }
                  }
0
Question by:zinno
    2 Comments
     
    LVL 4

    Author Comment

    by:zinno
    In my project settings, I had SQL Server debugging enabled. I turned that off and the problem went away.
    0
     

    Accepted Solution

    by:
    Question PAQ'd
    250 points refunded.

    CetusMOD
    Community Support Moderator
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now