Connections building up

jeffpeters

Member
Joined
Jul 28, 2006
Messages
14
Programming Experience
5-10
I am having problems with a build up of processes in my SQL database.

I am assuming it is because my connection is not being closed.

I have written a database access class and am using cn.Open followed by cmd.ExecuteReader. Once I have finished using the reader I do cn.Close and then dispose of the cn and cmd

But still my connection is there in the db.

Am I missing something? Should I add something to my cn String??

Thanks
 
No, you should leave it alone. If you want to know more about it, read up on .NET Coennction Pooling. Dont disable pooling without fully understanding the serious negative performance implications of doing so. Your code is working correctly as per M$ guidelines.
 
It's a performance.... then the next time you need a connection, it's been cached and it doesn't need to spin up a new connection. It simply goes to the pool and says "Hey, is there a connection in here doing nothing?" And the pool replies back "Yup! Here ya go!" .... Eventually after a certain length of time (controled by the server) the connection pool will eventually shut down the connections and the pool dries up.

-tg
 
Back
Top