Monday, March 12, 2007

Unclosed connection

Recently I facing this words too much, which is "Unclosed connection".

Normally when open a database connection with either Statement, Prepare Statement, Call Procedure, Result Set or Record Set , it need to be close at end of the page.

I faced this on my company project & my current website. After close the database connection at end of the page, the server didn't hold up a lot of objects, didn't use up all the memory & didn't make the server die.

* If there is some redirect code within the page, remember to close database connection before redirect as well.