How to find what is using the connections in my connection pool

Viewed 9535

I have a problem in the code that I have written using .NET.

The problem is that somewhere I have some dodgy database code that means that after some time I get the following error:

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.

I know that it is because somewhere I haven't disposed of one of my datareaders or something similar which means it still has the connection open so its not being returned to the pool. I'm having a bit of problem finding where this is happening in my code though.

So my question:

Is there any way to query the connection pool to find out what its in use connections are doing. I'm just looking for a way to find what query is being run to allow me to find the offending piece of code.

For what its worth I don't have permissions to run an activity monitor on the database in question to find out that way.

2 Answers
Related