Connection timeout

Discussion in 'Databases' started by hprider, Oct 24, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello All,

    I am getting the error below:

    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.

    I have the following connection string:



    <add name=" CommerceTemplate" connectionString=" Min Pool Size=5;Connection Lifetime=7;Max Pool Size=100;Data Source=tcp:mssqlnumber.discountasp.net;Initial Catalog=DB_mynumber_commercedb;User ID=DB_mynumber_commercedb_user;Password=password " providerName="System.Data.SqlClient" />


    I don't explicity open any connections in my code. I am using the Commerce Starter Kit for e-commerce which uses providers. This means that the connections are handled in the Microsoft Data Blocks at a low level. I do have various TableAdapters in DataSets that I have created using the DataSet wizard in Visual Studio 2005. These connections are also supposed to be handled at a low level by the .NET framework. Example:


    Dim productsAdapter As New NorthwindTableAdapters.ProductsTableAdapter()
    Dim products as Northwind.ProductsDataTable
    products = productsAdapter.GetProducts()


    This also doesn't require explicit closing of connections. Does anybodyhave any ideas as towhy Iam getting a timeout error?


    Thanks,


    Howard
     
  2. Timeout exceptions occur due to the fact that your application reaches themaximum pool size as it is clearly stated in the exception itself.Check out the source code for ProductsTableAdapter ,whether it closes the connection or not?

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. Hi guys,


    Thanks for the replies. However, I have already checked these things.


    1) I never directly open any connections. The Commerce Starter Kit uses providers for all their connections, relying on the Microsoft Data Blocks that manage the connections. I do use some Table Adapters on my data sets, but these are supposed to close connections after leaving the methods, or so I have read. Just in case, I have added the Dispose() method to close the TableAdapters after use like so:


    Dim brTableAdapter As New FrontEndTableAdapters.GetBrandListByCategoryTableAdapter


    Dim dt As FrontEnd.GetBrandListByCategoryDataTable


    dt = brTableAdapter.getBrandListByCategoryID(catID)


    Dim keywordString As String = ""


    For Each myrow As FrontEnd.GetBrandListByCategoryRow In dt


    keywordString = keywordString &amp; myrow("BrandName") &amp; ", "


    Next


    brTableAdapter.Dispose()





    2) I have set the Max Pool Size=100in the connection string.


    I don't know what else to do.


    Any further suggestions?


    Thanks,


    Howard
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    I really don't know what I can recommend but this error is very accurate. If you see this error, there are a lot of opened connection.

    You can also open a support ticket to see how manyconnections your application opened.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page