No announcement yet.

Updating Mirth's DB from Mirth

  • Filter
  • Time
  • Show
Clear All
new posts

  • Updating Mirth's DB from Mirth


    I'm drawing a blank here. I'm trying to update one Mirth channel by making a second channel modify Mirth's SQL Server DB.
    I've managed for it to modify the channel's name and to make minor changes on it's code with replace SQL statements.
    But when I try to make major changes I'm getting the error: "Invalid parameter index 1.".

    I've searched on that error and found nothing to help me, and I've searched for other ways to update channels on Mirth.
    The final intention is to put a file on a server and to get different computers to read that file and update its Mirth channel with the content on the file.

    I would be very grateful if you could help me solve my problem, or if you let me know of a better way to achieve my purpose.

    Currently using Mirth 3.4.1 and SQL Server 2012.

    Thank you all, mates!

  • #2
    First of all, you're just asking for problems by manually updating the database like that. Case in point, if you just manually edit the channel XML, the MC server will not pick it up automatically unless the revision changes as well.

    That "Invalid parameter index" error doesn't have anything to do with Mirth Connect per se. It means that your prepared statement is incorrect, like you're trying to set a parameter but you don't have any variable expressions in the actual statement.

    Perhaps a better way would be to use the REST API, or even the CLI. With the CLI for example you can create a script to import/update a channel, run it from the command line, and then embed it in your own bash script / cron job / whatever.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

    - How do I foo?
    - You just bar.


    • #3

      I'm stuck again. I've created a Mirth Channel which reads an *.xml file on a folder to update channels.
      First a channel reader maps the name of the channel to be updated.
      Then with a destination (destination 1), creates a .bat file which creates folders for updates and backups and calls Mirth's CLI to make the backups and the update.
      I've run the .bat and it does what I want, the problem is that I want a second destination (destination 2) which is a javascript writer, to execute the .bat automatically once destination 1 has created it. I've tried to do it in the postprocessor too.

      I've followed different posts on this (and other) forums (some of them listed here):

      I've tried different ways with Runtime and ProcessBuilder and I can't get it to work, I think that the problem is with the Path.
      The folder which contains the .bat is C:\Users\CK1\Desktop\Origen and the bat is named Autoupdate.bat.

      Can you throw some light on my problem?

      Thank you all!

      EDIT (02/09/2016):

      var pr = java.lang.Runtime.getRuntime().exec("c:\\Windows\\System32\\cmd.exe /C start C:\\Users\\CK1\\Desktop\\Origen\\Autoupdate.bat");
      It worked for me.
      Last edited by Glorx; 09-02-2016, 01:35 AM.