Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. DB connection location.

DB connection location.

Scheduled Pinned Locked Moved ASP.NET
databasequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sergeyv2002
    wrote on last edited by
    #1

    I pretty sure that someone came across the same dilemma: Where should I maintain the database connection object, should I open it once when the web application is started and close id when it is terminated or should I open and close it with each session. Which strategy is the one that is usually used ?

    N 1 Reply Last reply
    0
    • S sergeyv2002

      I pretty sure that someone came across the same dilemma: Where should I maintain the database connection object, should I open it once when the web application is started and close id when it is terminated or should I open and close it with each session. Which strategy is the one that is usually used ?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      A database connection should be opened as late as possible and closed as soon as possible. So you should only open it when needed in your application, like when retrieving data to bind to a datagrid for instance, not when the initial page that only has static content is displayed.


      only two letters away from being an asset

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups