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. Database & SysAdmin
  3. Database
  4. Auto reconnect to MySql when connection is lost after period of inactivity

Auto reconnect to MySql when connection is lost after period of inactivity

Scheduled Pinned Locked Moved Database
csharpdatabasemysqlsysadminhelp
6 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.
  • B Offline
    B Offline
    Bil l
    wrote on last edited by
    #1

    Hi, I have a c# application that uses a MySql database, the problem that after a period of inactivity (8 hours) or when connection to the server where database is host is lost, the connection to the database is closed and database queries cannot be executed. how can i enable the auto reconnect to the database. Best regards.

    Keep it simple, stupid!

    D I 2 Replies Last reply
    0
    • B Bil l

      Hi, I have a c# application that uses a MySql database, the problem that after a period of inactivity (8 hours) or when connection to the server where database is host is lost, the connection to the database is closed and database queries cannot be executed. how can i enable the auto reconnect to the database. Best regards.

      Keep it simple, stupid!

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Through a Timer in your C# code. :~

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      I 1 Reply Last reply
      0
      • B Bil l

        Hi, I have a c# application that uses a MySql database, the problem that after a period of inactivity (8 hours) or when connection to the server where database is host is lost, the connection to the database is closed and database queries cannot be executed. how can i enable the auto reconnect to the database. Best regards.

        Keep it simple, stupid!

        I Offline
        I Offline
        i i i
        wrote on last edited by
        #3

        why are you making your connection always active means you dont need to connect to db always, you should connect to the db when you need to connect at the time of doing any CRUD operations,it will resolve your inactivity problem. CCreate R Retrieve UUpdate DDelete

        Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

        1 Reply Last reply
        0
        • D dan sh

          Through a Timer in your C# code. :~

          It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

          I Offline
          I Offline
          i i i
          wrote on last edited by
          #4

          Shouldnot disconnected architecture will resolve it :doh:

          Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

          D 1 Reply Last reply
          0
          • I i i i

            Shouldnot disconnected architecture will resolve it :doh:

            Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            I was also thinking why would you need an active connection "forever". Then thought there might be something in his application that desperately needs it and hence the reply.

            It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

            I 1 Reply Last reply
            0
            • D dan sh

              I was also thinking why would you need an active connection "forever". Then thought there might be something in his application that desperately needs it and hence the reply.

              It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

              I Offline
              I Offline
              i i i
              wrote on last edited by
              #6

              :thumbsup:

              Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

              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