Timeout / Obtaining a connection from the pool - Please Help!

Discussion in 'ASP .Net' started by Martin, May 26, 2004.

  1. Martin

    Martin Guest

    Dear Group

    I'm desperate for a solution to this problem.
    Let's assume I've the following code:

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button4.Click

    Dim sqlConnection As New System.Data.SqlClient.SqlConnection

    sqlConnection.ConnectionString = "workstation id=THEINTREPIDFOX;packet
    size=4096;user id=sa;data source=""(local)"";p" & _
    "ersist security info=False;initial catalog=TestDB"

    sqlConnection.Open()
    sqlConnection.Close()
    sqlConnection = Nothing

    End Sub

    When I click 100 times on the button the page finally times out with:

    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.

    Of course I could increase the max pool size but this isn't the
    solution to this problem. I wonder what's wrong with my code?
    According to MSDN, if the connection is closed it's released back into
    the pool. Also tried to dispose but nothing helps. It looks like that
    it keeps connections and doesn't release them. I'm grateful for any
    hints, ideas, suggestions on this problem as I'm very desperate to
    solve this.

    Thanks very much for your time & efforts!

    Martin
     
    Martin, May 26, 2004
    #1
    1. Advertising

  2. Martin

    Natty Gur Guest

    Hi,

    Although close should call dispose to release unmanaged connection
    resource try to call it explicitly.

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, May 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guoqi Zheng
    Replies:
    4
    Views:
    13,034
    Guoqi Zheng
    Jun 3, 2004
  2. UJ
    Replies:
    1
    Views:
    9,223
    Hans Kesting
    Feb 10, 2006
  3. _XaToA_
    Replies:
    0
    Views:
    2,219
    _XaToA_
    Oct 30, 2003
  4. Tiwkiz
    Replies:
    0
    Views:
    640
    Tiwkiz
    Jan 27, 2007
  5. Adam Roe
    Replies:
    4
    Views:
    132
    Joe Kaplan \(MVP - ADSI\)
    Jan 22, 2004
Loading...

Share This Page