USEFUL SITES :
Write for Us
Why is connection pooling so beneficial? Creating a connection is expensive; it requires your application to connect to the database server, authenticate, and return a valid connection. Drawing from the pool eliminates this overhead. With web applications, proper pooling is absolutely critical to performance because IIS closes all of a page’s database connections after a page is processed. With hundreds, thousands, or millions of page requests, each wanting a new database connection, were it not for pooling, our site’s performance would quickly become unacceptable.
Take this quick test to see how well you understand connection pooling with IIS and SQL Server. Keep track of which questions you answer true and, if you’re impatient like me, skip to the end of this article, otherwise follow along as we dissect each answer.
Establishing Our Baseline
Before we can accurately assess what our connection pool is doing, we need to look at it under the ideal scenario. Let’s create an ASP page that opens 1000 connections as quickly as possible. All connections will use the same connection string and perform only a simple SELECT statement. We’ll use the pubs database with a login name of “pubsLogin”.
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Option Explicit
Const strConnectString = "Provider=sqloledb;User ID=pubsLogin; pwd=pubsPassword; Data Source=YourServerName; Initial Catalog=pubs"
Const strSQL = "SELECT * FROM Authors WHERE au_lname='This is SQL Statement 1'"
Dim cnPubs ' As New ADODB.Connection
Dim i
For i = 1 To 1000
Response.Write "Iteration " & i & “<br>”
Set cnPubs = Server.CreateObject("ADODB.Connection")
cnPubs.ConnectionString = strConnectString
cnPubs.Open
cnPubs.Execute strSQL
Response.Write " ” ‘ our simple delay tactic
cnPubs.Close
Set cnPubs = Nothing
Response.Flush
Next '
Response.Write “<p>Done”
</script>