Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when NOT closing recordsets in classic asp?

In legacy applications at work, i see not closed recordsets scattered on lots of pages.

  • What consequences does this have?
  • Does the connection close automatically?
  • Are resources released at the end of every request?

Update:

  • Another question related to this problem i think

txn!

like image 208
Sander Versluys Avatar asked Oct 24 '25 18:10

Sander Versluys


2 Answers

  • What consequences does this have?

Resources don't get freed up as quickly, and depending on the rest of the code performance will suffer.

  • Does the connection close automatically?
  • Are resources released at the end of every request?

At the end of page execution, all connections are terminated and all resources released. Some people figure that since this happens, there is no need to worry about explicitly closing connections and/or releasing resources.

All things being equal, reliance on this is not something that is encouraged as you never know how things will play out in heavy traffic - which is why all the good tutorials/instructors will tell you to open only when you need, and release as soon as you are done.

like image 174
AnonJr Avatar answered Oct 26 '25 18:10

AnonJr


Close recordset does not close the connection

http://www.devguru.com/technologies/ado/QuickRef/recordset_close.html

You should always close connections as soon as possible, to release them back into the connection pool.

A system that leaks connections will slow down and gradually grid to a halt.

like image 34
Shiraz Bhaiji Avatar answered Oct 26 '25 20:10

Shiraz Bhaiji