web stats
Skip to end of metadata
Go to start of metadata
Icon

This guide is applicable to Mirth Connect 1.x. Mirth Connect 2.x contains some of the files mentioned in mirth-dbconf.jar, and Mirth Connect 3.x requires additional changes to add a new server datasource.

 

There are several steps that need to be taken to add support for a new database in Mirth.

Step 1: Add the DDL script. These reside in the %MIRTH_HOME%/conf/database directory with the filename database-database.sql. This file is executed by iBATIS when Mirth Connect is run for the first time only if the CONFIGURATION table is not found. This means that you can skip this step by running the script to create the tables using your preferred DB tool before starting the server for the first time. The code for executing the script can be found in DatabaseUtil.java#executeScript.

The RDBMS is selected by setting the database property in the %MIRTH_HOME%/conf/mirth.properties file. Note that the value of that property must match the subsequent references to database. Some example values are postgres or firebird.

Step 2: Add the connection properties. This is in the %MIRTH_HOME%/conf/database directory in a file named database-SqlMapConfig.properties. This includes a reference to the driver for the database, the URL, and your credentials.

Step 3: Add the iBATIS scripts. These are in a new folder in the %MIRTH_HOME%/conf directory named database. You should copy the files from an existing database and replace/modify the statements for your RDBMS. Each statement is called by the Mirth Connect server.

Step 4: Add your JDBC driver jar file to the server's classpath by placing it in the %MIRTH_HOME%/custom-lib directory and restarting the server.

  • No labels

7 Comments

  1. I'd like to add a practical step-by-step guide to changing the datasource to SQL Server 2008. It took me a while to gather all the information, so I figure it would be useful to others.

    How to configure Mirth to use SQL Server 2008

    1) Back up your Mirth Configuration, if one exists, by using Settings … Backup … from inside of the Mirth Client.
    2) Close the Mirth Client.
    3) Start SQL Server 2008 SSMS.
    4) Create a database called mirthdb.
    5) Add a user called mirthuser and choose a password.
    6) Give user Owner permissions for database.
    7) In SSMS, switch the database to the mirthdb database.
    8) Open the following file in Notepad:
    C:\Program Files\Mirth Connect\conf\sqlserver\sqlserver-database.sql
    It is a SQL Script file.
    9) Copy the entire contents into a SQL query pane in SSMS.
    10) Execute the query.
    11) Execute this additional line of SQL:
    ALTER TABLE CODE_TEMPLATE ADD [ID] [int] NULL
    12) Stop the Mirth service.
    13) Change the database type from Derby to SQL Server.
    14) On the Server tab, change the Web Start Port to 8081.
    15) On the Database tab, the URL should be something like:
    jdbc:jtds:sqlserver://yoursqlserver2008name:1433/mirthdb
    16) On the Database tab, add the user credentials that you created in step 5.
    17) Start the Mirth Service.
    18) Start the Mirth Client.
    19) Restore you Mirth Configuration, if you created a backup in step 1, by using Settings … Restore … from inside of the Mirth Client.
    20) Verify the all communication/data is restored.

    If communication is not restored, you may want to check if TCP/IP is enabled in SQL Server.

    Hope this proves useful to some!

    1. Very useful set of steps, Walter.  That saved me a lot of effort.

      After following these steps I noticed that I was unable to save or restore my code templates.  In step 11, Shouldn't this read ALTER TABLE CODE_TEMPLATE ADD [ID] varchar(36) NULL, as the Code Templates are saved with a GUID for the ID. (I would have suggested the uniqueidentifier data-type, but wanted to remain consistent with the other tables)

      1. I'm glad you found the steps useful.

        I've not used the Code Templates feature to date, ... I think I came across the need to add the field and assumed the field was numeric because of some other table entries. But if you have found that using varchar(36) works, then I would say to use it.

        It would probably be best for a Mirth developer to definitively comment, (or better yet, include the field in the script itself), but as is, it should work with varchar(36).

        hwn

  2. Hi Walter

    I just started working with Mirth Connect today. Everything is fine with your instructions until I get to step 8 C:\Program Files\Mirth Connect\conf\sqlserver\sqlserver-database.sql.  On my system, there is no SQL scripts located anywhere in the Mirth Folder. Is there  something else I need to install or download?

     

    1. I have the same proble, can someone tell me where to find C:\Program Files\Mirth Connect\conf\sqlserver\sqlserver-database.sql file?

      I am running Mirth Connect Server 2.2.1.5861 64 bit version on windows 7 64bit.

       

      Thanks

      1. Never mind, by trial and error I figured out that that step is not needed anymore. Mirth creates the tables and everything needed after you restart the server. Very smart thing, I absolutely love Mirth !!

         

        Thanks

  3. HI,

    i am currently working on mirth and have been trying to establish a connection between mirth and sql server 2008 and have found no success despite following all the methods given on this forum.kindly suggest me any procedure