[thelist] DBCon to SQL good/bad practice

Rob Smith rob.smith at THERMON.com
Mon Nov 24 10:41:40 CST 2003

<snip author="john">
If you are making DB connections to a database such as SQL, should you close
any connection you open?  Is it bad practise to leave them open?

There are two sides to this coin John. Yes is the primary answer your
question. Granted the SQL server will cut off inactive connections after a
certain period of time, but that's lost processing time by the SQL Server.

I've found ways for the other side, No, to be ok. For example, I've have one
database call for a particular piece of the web site, and then based on that
query, I'll do another one. But to save code, I'll reuse that connection

MySQL.Source="Select blah, blah, blah ..."

<!-- display material -->



If the page starts to complain about active database connections, I'll stick
a mySQL.close() before I reinitialize the source.


More information about the thelist mailing list