Connection Pooling

I'm running a classic ASP application and I'm a little confused about connection pooling. Please tell me if the example code below utilizes connection pooling and if not what would I need to change?

Or, how can I refine the code for better performance?

Dim rsSeason, season_name, intGameLength, TeamID, rsTeam, teamname, playername, rsplayer, intSeasonID, intPlayerID. strSQL, objConnHockey

set objConnHockey = Server.CreateObject("ADODB.Connection")
objConnHockey.Open "Provider=SQLOLEDB; Data Source=LOCALHOST; Initial Catalog=Northwind; User ID=Data; Password=password"

strSQL = "SELECT * FROM Season WHERE LeagueID = '" & strLeagueID & "' AND ID = " & intSeasonID & ""
Set objrsSeason = Server.CreateObject("ADODB.Recordset")
objrsSeason.Open strSQL, objConnHockey, 0
intGameLength = int(objrsSeason("GameLength"))
season_name = objrsSeason("Season_Name")
objrsSeason.close
set objrsSeason = nothing

strSQL = "SELECT * FROM Team WHERE LeagueID = '" & strLeagueID & "' AND TeamID = " & intTeamID & ""
Set rsTeam= Server.CreateObject("ADODB.Recordset")
rsTeam.Open strSQL, objConnHockey, 0
teamname = rsTeam("name")
rsTeam.close
set rsTeam= nothing

strSQL = "SELECT * FROM Player WHERE LeagueID = '" & strLeagueID & "' AND PlayerID = " & intPlayerID & ""
Set rsplayer= Server.CreateObject("ADODB.Recordset")
rsplayer.Open strSQL, objConnHockey, 0
playername = rsplayer("first_name") & " " & rsplayer("last_name")
rsplayer.close
set rsplayer = nothing

objConnHockey.close
set objConnHockey = nothing

      
sportzoneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

strickddCommented:
In its most primitive sense, yes. Since all the recordsets use the same connection that is open from start to finish, these all use a "pooled" connection.
0
sybeCommented:
In Classic ASP, connection pooling is not in the code, but a setting of the machine, iis and the database. Classic ASP supports connection pooling automatically when the machine does that.

> how can I refine the code for better performance?


- Only request the columns you need. So get rid of "SELECT *", but use "SELECT columnname "
- You could re-use the recordset object.
<%
Dim oRS
Set oRS = Server.CreateObject("ADODB.Recordset")
' open oRS with a SQL statement
' get value in variable
' close recordset (do not destroy it yet)

' open oRS with another SQL statement
' get value in variable
' close recordset (do not destroy it yet)

' open oRS with another SQL statement
' get value in variable
' close recordset

' finally, close it


- Or you could try to get all necessary variables in a single query, use inner joins on the different tables. You could even make it a stored procedure (so it will be a precompiled query).

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sportzoneAuthor Commented:
Hi Sybe,

Is there any chance you could provide a sample code based on my code above?

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.