SQLTeam.com | Weblogs | Forums

The timeout period elapsed prior to obtaining a connection from the pool


#1

we just had an error on our site:

"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"

Don't think we've had this before and I just checked the number of users logged in today and it was only about 12 (and 30 yesterday).
after some initial research, i think its suggested we should open and close our connections? is this right? do we need to put something like:

     sqlconnection1.Open(); and sqlconnection1.Close(); 
   //  in all our connection strings in all asp.net pages?
	   or conn.Open() and conn.Close()
	  // in all .vb pages?

All our connections on each page are pretty much like this:
> <asp:SqlDataSource ID="ourID" runat="server" ConnectionString="<%$ ConnectionStrings:LocalSQLServer %>"

  		SelectCommand="SELECT ourIDNo FROM dbo.aspnet_ourUsers INNER JOIN dbo.tblourTable ON dbo.aspnet_ourUsers.ourIDNo = dbo.tblourTable.ourIDNo WHERE (dbo.aspnet_ourUsers.UserId = @UserID)">
  			<SelectParameters>
  				<asp:Parameter Name="UserID" />
  			</SelectParameters>		   
  	</asp:SqlDataSource>

I recycled the application pool and it fixed the issue, but not sure what caused it. Any ideas?
thanks.