Disalowed Gateway Routing

Clovertech Forums Read Only Archives Cloverleaf General Disalowed Gateway Routing

  • Creator
    Topic
  • #54649
    Mike Strout
    Participant

      I am on 6.0.1 and am trying to write to a Sqlite DB. The connection works fine in our TST environment, but  when I run the same script in our PRD environment, the message lands in the EDB with a message state of Disallowed Gateway Routing (106).

      I found an old thread in which Max Drown states that this is caused by a known JDBC issue and that AR 10323 (Add a new Error DB state for PD_ERR_BADDATA error in message writing) has been created for it. Supposedly AR 10323 is scheduled in CIS6.2.

      Can anyone tell me if there is a work-around for this issue? This DB write is part of a pretty mission critical process and I can’t wait to for a patch to implement it.

    Viewing 9 reply threads
    • Author
      Replies
      • #82406
        Rob Abbott
        Keymaster

          Hi Mike please open a support ticket.  It’s odd that this works in one environment and not in another.

          Rob Abbott
          Cloverleaf Emeritus

        • #82407
          Mike Strout
          Participant

            Thanks. Already did.

            I should also add that it works most of the time in PRD. It could be that we just haven’t passed enough messages through in TST to experience the scenario that causes the failure. My guess is that there is some character in one of the fields that is breaking the insert, or one of the fields is overflowing. I haven’t had a chance to dig in and compare the messages yet.

          • #82408
            Terry Kellum
            Participant

              Just a wild suggestion.  From the sqlite doco:

              db1 eval {INSERT INTO t1 VALUES(5,:bigstring)}

              The use of “:” instead of “$” before the name of a variable can sometimes be useful if the SQL text is enclosed in double-quotes “…” instead of curly-braces {…}. When the SQL is contained within double-quotes “…” then TCL will do the substitution of $-variables, which can lead to SQL injection if extreme care is not used. But TCL will never substitute a :-variable regardless of whether double-quotes “…” or curly-braces {…} are used to enclose the SQL, so the use of :-variables adds an extra measure of defense against SQL injection.

              I would also add that this is a layer of defense against TCL meta characters as well.

            • #82409
              Charlie Bursell
              Participant

                I am not sure this is a sqlite error.  I cannot find that code anywhere in the sqlite documentation.  Perhaps a call to Support and they can check with R&D as to the error meaning.

                Howver, I agree that the colon variable name “:var” = $var.  It may be of some use for some sqlite implementations.

                Also if you suspect in may be a data typing issue with only some messages you could try the ampersand variable.  

                Instead of:

                                     db1 eval {INSERT INTO t1 VALUES(5,$var)}

                Try:

                                     db1 eval {INSERT INTO t1 VALUES(5,@var)}

                This forces the value to be inserted as a blob even if it contains text

                Take a look at this page for more explanation:

                https://www.sqlite.org/tclsqlite.html

              • #82410
                Jeff Dinsmore
                Participant

                  I have no idea if this is related, but another thing I’ve run into with SQLite is its handling of apostrophe.  I used to have sporadic failures related to this.

                  If you have a value that contains an apostrophe – maybe an address like “1234 Pirate’s Cove” – SQLite doesn’t like that.  You can escape them with a double apostrophe.

                  Whenever I’m inserting text, I’ll use this proc:

                  Code:

                  proc crmcSqliteUtils::subSingleQuote { inStr } {
                  return [string map {’ ”} $inStr]
                  }

                  Jeff Dinsmore
                  Chesapeake Regional Healthcare

                • #82411
                  Mike Strout
                  Participant

                    Thanks for all your thoughts so far. The plot is thickening a bit and has been split into a few different issues.

                    First is the “Disallowed Gateway Routing” error. It is starting to look like this is the default error Cloverleaf throws when the JDBC driver throws errors like primary key constraint issues or syntax issues in the executed SQL statement. In my situation, we were getting duplicate order numbers on the vaccination feed from Epic, one for the vaccination administration and a second for the administration cancel. Converting the SQL statement from an INSERT to a REPLACE solved that issue, but there is still a lingering issue.

                    I have noticed that when Cloverleaf executes the REPLACE or previously the INSERT statement, it is truncating the hl7_msg field in which we pass the entire HL7 message. Interestingly, it isn’t truncating the end of the message, but instead, it is dropping the MSH segment and writing the PID and beyond to the DB. To troubleshoot the issue, I have done the following…

                    1. I used the testing tool to execute the tcl proc to generate the “message” that is ultimately execute by the OB DB connection. This message is a simple VRL with a datestamp, mrn, order number and the original source message.

                    2. Next, I used the Database Protocol in the testing tool to send the VRL message to the OB database thread. This is a pretty handy tool as it will verify that the SQL will succeed and then seemingly rolls back the transaction so the DB write never actually happens. If it fails, it gives pretty good troubleshooting info.

                    3. However, because it rolls back the transaction, I can’t really tell what gets written to the DB…did the message field get truncated.

                    4. To resolve this, I copied the “Executed SQL” displayed by the testing tool. I then opened the sqlite command line interface and pasted this executed SQL string. It threw an error because the datestamp wasn’t quoted, nor was HL7 message. When I single or double quote these two fields in the insert statement, the entire insert happens flawlessly.

                    5. Emboldened by my successful test, I thought I could just quote the necessary fields in the outbound DB connection properties and Bob would be my uncle.

                    6. I re-ran the Database Protocol  test in did in #2 above with these tweaked SQL statement and I get a SEVERE: error stating “Array index out of range: 3”. I interpreted as the quotes make the interpreter think there are more values than fields.

                    As I typed all this up, I realized that executing the SQL from the Sqlite command lite is not a realistic test because it doesn’t use the JDBC driver which obviously must automatically quote date and string values based on some magic.

                    After all this testing (and this way too long Clovertech post), I find myself back at square one trying to figure out why the JDBC driver would consistently pre-truncate the HL7 message always at the same place, just before the PID segment.

                    Any ideas or suggestions?

                  • #82412
                    Terry Kellum
                    Participant

                      Just wondering, why JDBC and not direct TCL SQLite?  Seems like that introduces an extra layer.  Might be a good troubleshooting step to test direct.

                    • #82413
                      Mike Strout
                      Participant

                        I am using JDBC because it is what Cloverleaf uses in its database protocol.

                      • #82414
                        Michael Hertel
                        Participant
                        • #82415
                          Mike Strout
                          Participant

                            I saw that post, but I couldn’t quite figure out what they meant by External  or Vendor. Plus, through my testing I figured out that “Disallowed Gateway routing” pretty much means “General SQL Error”. By using the Database Protocol component of the Testing tool, one can get more details about the error that caused the “Disallowed Gateway routing”.

                        Viewing 9 reply threads
                        • The forum ‘General’ is closed to new topics and replies.