ODBC Database connection question…

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf ODBC Database connection question…

  • Creator
    Topic
  • #51880
    Tom Rioux
    Participant

      I have an ODBC script that is calling a stored procedure on our EMPI database.   Originally, the code was set up to shut down the thread if we lost connection to the database.   This was done because messages would fail on the downstream system if the information we are placing in the messages from the ODBC call was not there.  I had that coded, the script was working and everything was right in my world.

      Now a request has come in to modify the code so that the thread does not shut down.  Instead, the code is being modified to check the primary database first, then, if the connection fails or is lost, then switch to the replicated database that resides elsewhere.

      At some point, when the primary database is available again, I would like to reconnect to it.   Does anyone know of a clean way to ping/query the database to see if it is available without actually connecting to that database?   I don’t want to disconnect from the replicated one and attempt to reconnect to the primary only to find it is still down.  (We connect at startup not with each message).   Also, I’ve attempted to use the tnsping utility that is on the Cloverleaf box but I am getting a “permission denied” error.

      Any help would be greatly appreciated….

      Tom Rioux

    Viewing 1 reply thread
    • Author
      Replies
      • #72121
        Jim Kosloskey
        Participant

          Tom,

          In the odbc.ini file (or via execute time connect) there is a method to define alternate hosts for most DB types.

          Then when you attempt a connect the odbc drivers automatically try to connect to the first host that will connect. The DB side needs to be configured correctly of course.

          We have used this and it requires no additional work in our Tcl code.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

        • #72122
          Tom Rioux
          Participant

            Jim,

            Thanks for the info.   I just got back from vacation and will explore your suggestion.   This sounds like it is just what I need.  I had completed some coding before I left but kept getting errors.  

            Thanks…Tom

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.