DataAccess Block issue

C

Craig Buchanan

I'm using the SQLHelper class from Microsoft's DataAccess block in my code.
Recently, I've been getting an error when I try to use the class'
ExecuteReader method. The error reads:

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.

Obviously the connection is not being Dispose(d), but why is this occuring
now? Were is the max pool size setting being set? Should I be calling the
dispose method manually?

Thanks,

Craig Buchanan
 
D

David Browne

Craig Buchanan said:
I'm using the SQLHelper class from Microsoft's DataAccess block in my code.
Recently, I've been getting an error when I try to use the class'
ExecuteReader method. The error reads:

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.

Obviously the connection is not being Dispose(d), but why is this occuring
now?

Because the garbage collector will eventually close the connection, so you
won't see this problem until you get some load.
Were is the max pool size setting being set?
In the connection string, default of 100 I think.
Should I be calling the dispose method manually?

That is an absolute requirement.

David
 
C

Craig Buchanan

David-

I just did a test. I was able to get the timeout error after 8 calls to the
database. In another .net project, I wasn't able to get the error to occur.

Same machine. Same version of .Net (1.1). Same SQL Server 2000 (local).
The connection strings look identical (except for initial catalog).
Connection strings don't specify pool size.

It doesn't make any sense.

Thoughts?

Craig
 
D

David Browne

Craig Buchanan said:
David-

I just did a test. I was able to get the timeout error after 8 calls to the
database. In another .net project, I wasn't able to get the error to occur.

Same machine. Same version of .Net (1.1). Same SQL Server 2000 (local).
The connection strings look identical (except for initial catalog).
Connection strings don't specify pool size.

It doesn't make any sense.

Thoughts?

You can walk on thin ice a dozen times without falling in. You wouldn't ask
why you fell in the 13th time. The answer is the weather, or currents or a
small defect in the ice, or whatever.

It all depends on the memory size and the frequency of garbage collections
and other factors. Just Dispose of your connections properly.

David
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top