Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Classic ASP - using one connection for many queries?

Consider a classic ASP site running on IIS6 with a dedicated SQL Server 2008 backend...

Scenario 1:

Open Connection
Do 15 queries, updates etc all through the ASP-page
Close Connection

Scenario 2:

For each query, update etc, open and close the connection


With connection pooling, my money would be on scenario 2 being the most effective and scalable.

Would I be correct in that assumption?

Edit: More information

This is database operations spread over a lot of asp-code in separate functions, doing separate things etc. It is not 15 queries done in rapid succession. Think a big site with many functions, includes etc.

like image 490
Kjensen Avatar asked Jan 23 '23 23:01

Kjensen


1 Answers

Fundamentally, ASP pages are synchronous. So why not open a connection once per page load, and close it once per page load? All other opens/closes seem to be unnecessary.

like image 196
Matthew Groves Avatar answered Jan 31 '23 07:01

Matthew Groves