[thelist] Question about DB connections in ASP

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Thu Mar 2 07:54:04 CST 2006


>Is there a performance hit to opening a connection and leaving it open
>for an entire page, or is it better to open and then close several
>different connection objects?

That depends on the database. Access performs better when you open
connection use it and then close it asap. That's because Access is not
as multi-thread / multi-user friendly as other databases around.

Actually, it is arguable whether you can call Access a database or not :)

However SQLServer, DB2, MySQL etc will not feel a performance hit.
Actually for those more-database-like databases, opening and closing
the connection several times brings up a performance hit since
creating a Connection object is a costy operation.

Here is what I use 99% of the time:

_beginnin of page
DBInit
DBConnect

... do stuff ...

DBDisconnect
DBRelease
_end of page

I have used this structure in dozens of high-load commercial portals
and did not observe any performance hit (using SQL Server most of the
time)


HTH,
--
Volkan Ozcelik
+>Yep! I'm blogging! : http://www.volkanozcelik.com/volkanozcelik/blog/
+> My projects/studies/trials/errors : http://www.sarmal.com/



More information about the thelist mailing list