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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. SQL Database Connection

SQL Database Connection

Scheduled Pinned Locked Moved C#
databasequestion
5 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.
  • D Offline
    D Offline
    Darkness84
    wrote on last edited by
    #1

    I am working on an application that maintains an open connection to an sql database. I also have a timer that checks to see if the connection has closed and if so, it tries to re-opens the connection. This is working fine at the moment as my application and the database are running on the same computer. However this application will eventually run on a different computer to where the database will be. What I would like to know is if for some reason the connection from the computer running the application and the computer with the database were to become disconnected, would my application view this as the connection being closed?

    C 1 Reply Last reply
    0
    • D Darkness84

      I am working on an application that maintains an open connection to an sql database. I also have a timer that checks to see if the connection has closed and if so, it tries to re-opens the connection. This is working fine at the moment as my application and the database are running on the same computer. However this application will eventually run on a different computer to where the database will be. What I would like to know is if for some reason the connection from the computer running the application and the computer with the database were to become disconnected, would my application view this as the connection being closed?

      C Offline
      C Offline
      coolestCoder
      wrote on last edited by
      #2

      Darkness84 wrote:

      I am working on an application that maintains an open connection to an sql database

      First of all, I would like to know the conditions under which you need an open connection to the database (always) ? I think you can open the connection just at the time of your query execution. what is the problem in this kind of scenario ? Persisting database connections will load your database server. I dont think that this is desirable.


      "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


      coolestCoder

      D 1 Reply Last reply
      0
      • C coolestCoder

        Darkness84 wrote:

        I am working on an application that maintains an open connection to an sql database

        First of all, I would like to know the conditions under which you need an open connection to the database (always) ? I think you can open the connection just at the time of your query execution. what is the problem in this kind of scenario ? Persisting database connections will load your database server. I dont think that this is desirable.


        "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


        coolestCoder

        D Offline
        D Offline
        Darkness84
        wrote on last edited by
        #3

        I am using SqlDependency so that my application will respond immediately to changes in the database and thus i need the connection to be open.

        C 1 Reply Last reply
        0
        • D Darkness84

          I am using SqlDependency so that my application will respond immediately to changes in the database and thus i need the connection to be open.

          C Offline
          C Offline
          coolestCoder
          wrote on last edited by
          #4

          Hi, I dont know much about the SqlDependency, here[^] is an article on CP, which specifies (at the last) that the connection need not be open to recieve change event. Will this solve your problem ?


          "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


          coolestCoder

          D 1 Reply Last reply
          0
          • C coolestCoder

            Hi, I dont know much about the SqlDependency, here[^] is an article on CP, which specifies (at the last) that the connection need not be open to recieve change event. Will this solve your problem ?


            "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


            coolestCoder

            D Offline
            D Offline
            Darkness84
            wrote on last edited by
            #5

            Not sure, but I'll have a read. Thanks.

            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