Suppose I have an ASP.NET page. In the page load event handler, I open a database connection and do some processing. But after processing is complete, I do not close the connection explicitly by calling the CLOSE method of the connection object.
Now that the server side page processing is complete, the GC will have all the variables on my page as well as the connection object. But when it is located, the connection that was opened earlier is automatically closed? I mean, when the GC removes the connection object, it automatically closes the connection that was established with the database server; or does it just delete the connection object, and the connection in the database remains open until the connection timeout occurs in the database, and then the database server closes the connection itself?
MD Sayem Ahmed
source share