Putting my connection in aan application-var

Results 1 to 2 of 2

Thread: Putting my connection in aan application-var

  1. #1
    Bart Mortelmans Guest

    Default Putting my connection in aan application-var

    When testing the speed of my ASP-pages I noticed a lot of time was lost opening and closing the databaseconnection. Now I know it&#039s not a good idea to put the connection in a session-var, but why shouldn&#039t I put a DB-connection in an application var and never close it?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Putting my connection in aan application-var

    Beacuse the connection object isn&#039t thread-safe for use at Application scope, plus you&#039d be forcing all you users to contend for the use of a single connection. There&#039s a lot of infrastructure trying to make sure connections are shared efficiently and you&#039ll lose all of that. In fact you&#039ll probably kill your server. At the very least you&#039ll reduce the maximum number of genuinely concurrent users to one. Does that sound like a good idea?<BR><BR>Put your connection string in an Application var and use that to create a connection when you need one,then kill it as soon as you can - this is the route to scalability. Let the underlying framework worry about optimising your connections - that&#039s what it&#039s there for.<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts