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. General Programming
  3. C#
  4. How long the database connection stays open

How long the database connection stays open

Scheduled Pinned Locked Moved C#
databasehelp
4 Posts 3 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.
  • N Offline
    N Offline
    netJP12L
    wrote on last edited by
    #1

    Can somebody tells me how long the connection to the database stays open if the connetion is not closed in the function. If connetion stays open, meanwhile can we do the database restore or backup. Will that cause a problem. Thanks

    S 1 Reply Last reply
    0
    • N netJP12L

      Can somebody tells me how long the connection to the database stays open if the connetion is not closed in the function. If connetion stays open, meanwhile can we do the database restore or backup. Will that cause a problem. Thanks

      S Offline
      S Offline
      spiritboy
      wrote on last edited by
      #2

      i am not sure but as the expierience says open connections will be closed automatically after sometime that is being idle, for backing up and restore u should close all open connections(u can simply drop the database) ,otherwise u'll recieve error

      N 1 Reply Last reply
      0
      • S spiritboy

        i am not sure but as the expierience says open connections will be closed automatically after sometime that is being idle, for backing up and restore u should close all open connections(u can simply drop the database) ,otherwise u'll recieve error

        N Offline
        N Offline
        netJP12L
        wrote on last edited by
        #3

        I am not convinced why one need to have database connection closed while performing the database backup. However, database restore make sense. Can you elaborate little more or perhaps a resource that may help me out.

        D 1 Reply Last reply
        0
        • N netJP12L

          I am not convinced why one need to have database connection closed while performing the database backup. However, database restore make sense. Can you elaborate little more or perhaps a resource that may help me out.

          D Offline
          D Offline
          dano2k3
          wrote on last edited by
          #4

          A couple of the most obvious reason for me would be, a database may not flush data to disk until a connection is closed, or a connection could be in the middle of a long running operation, possibbly in a transation or not, backing up the database when this long running operation is in the middle of doing what it needs to.... Your data if you restore it in the backed up state you'll have data corruption.

          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