web stats
Updating Mirth's DB from Mirth - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 08-22-2016, 04:52 AM
Glorx Glorx is offline
What's HL7?
Join Date: Aug 2016
Posts: 3
Glorx is on a distinguished road
Question 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!
Reply With Quote
Old 08-22-2016, 07:56 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road

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.
Reply With Quote
Old 09-01-2016, 04:10 AM
Glorx Glorx is offline
What's HL7?
Join Date: Aug 2016
Posts: 3
Glorx is on a distinguished road
Question Solved

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 at 02:35 AM.
Reply With Quote

channels, mirth, server, sql, update

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 06:58 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation