View Full Version : Application connection object
noah watkins
10-30-1999, 02:53 PM
What would you say about keeping a connection object in an application variable? Performance mainly is what I'm after. Also, would that cause problems with performance say on SQL Server?<BR><BR>
Scott Mitchell
10-31-1999, 02:15 PM
I would wholeheartedly encourage you NOT to put the connection object in the Application. This would mean that there was one connection object for your entire web site. So, if you have ten simultaneous users requesting information from a database, user 1 would get the use the connection, while 2 through 10 would wait. Then 2 would get to use it, then 3, and so on. Bad, bad, bad.<BR><BR>Rather, you should create a connection object on each page that needs one. This is how you should do it.
noah watkins
10-31-1999, 08:38 PM
That is, of course, how I do it (one for each page). I was just interested in how that might work.<BR><BR>I probably should have said, Can a connection be used by more than one user at the same time.
Scott Mitchell
11-01-1999, 01:48 PM
A single connection can only be used by one user at a time. When mutilple people visit your site simultaneously, multiple connection objects are created (well, pooled). When using one connection object in the application scope, there is only one instance of the connection object, and each user is cursed to waiting until it is not being used by others. :(
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.