Connection Pool

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm flooding the .NET Sql Client connection pool again! I'm also using the Microsoft Application Block "SqlHelper" which I've traced.

I'm doing an ExecuteNonQuery. Each time I run this thing, I get stomped at the 100th insert. The connection.Close() method _is_ being called in SqlHelper. I know it. But for some reason, I'm overflowing?

I've read a lot of articles, but to no avail. Any direction appreciated.

Thanks,

AJ
 
AJP said:
I'm flooding the .NET Sql Client connection pool again! I'm also
using the Microsoft Application Block "SqlHelper" which I've traced.

I'm doing an ExecuteNonQuery. Each time I run this thing, I get
stomped at the 100th insert. The connection.Close() method _is_ being
called in SqlHelper. I know it. But for some reason, I'm overflowing?

When you say "I know it" - do you know that there is a call to
connection.Close(), or that it's actually definitely being called?
There's a big difference, if they've forgotten to put it in a finally
block, or something like that.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Jon, you're exactly right, thanks.

They hadn't used a try-finally block, and an exception was being thrown from the SqlHelper which I caught, but the reference to the connection was lost.

I'm going to alter the SqlHelper with a finally block which closes the connection, then propagates the exception back to my code.

Thanks again,

AJP
 
Back
Top