Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connection pooling

Status
Not open for further replies.

tembalena

Programmer
Apr 17, 2001
37
ZA
I've built a .NET application in which I ensure that every connection to the dbase is closed immediately after use. While running the app, the connections in the dbase increase continually until all the pooled connections are used. I then get timeout errors from the app as follows:

Error: Exception of type System.Web.HttpUnhandledException was thrown.

System.InvalidOperationException: 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.
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)

Any ideas on what may be causing this and how to fix it?
 
Try using [ConnectionObject].Dispose() when closing your database connections. Make _sure_ that you are closing your connections everywhere (I ran up against this same problem, and it came from me not closing connections in, say, error handling functions :p)

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
[ConnectionObject].Dispose()

How does this relate to "connection pooling?"

My understanding of connection pooling is that even though a connection is closed in code, it is still held ready to re-open for several minutes - thereby minimizing the 40K requirement of re-opening the database (connection pooling).

For example, if you use:

dbconn.Close()
dbconn.Dispose()

is that better than

dbconn.Close()

alone? And does it re-enforce connection pooling? If you dispose of the connection is it just local for the current Session ID. I have not seen many good arguments on this but several posts talking about it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top