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.