Quantcast
Channel: User scio me nescire - Stack Overflow
Viewing all articles
Browse latest Browse all 38

ado connection pooling connected vs disconnected

$
0
0

Before jumping the gun and marking duplicate, I've searched an have not had luck with a clear answer.

Background:
A co-worker and I had a discussion on datareader vs dataset with me on the datareader side.

What it boils down to is that I like the datareader because its lightweight, and my co-worker likes the dataset because its disconnected.

His reasoning is that since the dataset is disconnected, .net will fill the dataset and release the connection back into the pool (our server gets millions of hits a day).

He also stated that even if I wrap the sqlconnection and datareader in a using statement, the connection doesn't get released right away because the using statement is just doing a try catch finally and calling the connection.close and dispose anyway, which is bad because we have to wait for the garbage collector to run, and who knows how long that will take. In the meantime, the connection doesn't get returned to the pool.

My question:
Is he right? And will using the datareader cause the connections in the pool to shrink until garbage collection runs?


Viewing all articles
Browse latest Browse all 38

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>