HL7 Starter Kit – Free Project Tools HL7 Starter School

mirth_connect

Connect to MS Access from Mirth March 21, 2017

I installed Mirth Connect today and used the latest java which is Java 8.

Here are the instructions for those who are using Java 7 or previous versions and want to connect to MS Access from Mirth.

https://www.mirthproject.org/community/forums/showthread.php?t=3011

Keep reading if you have Java 8.

https://www.mirthcorp.com/community/issues/browse/MIRTH-3634

Jackcess:

http://jackcess.sourceforge.net/

Place jackcess jar in C:\Program Files (x86)\Mirth Connect\custom-lib

  • Databaser Reader
  • Click “Use Javascript” to YES.
  • Paste the code below in the “javascript” section
//
//Jaccess Documention links below
//
//https://jackcess.sourceforge.io/apidocs/com/healthmarketscience/jackcess/DatabaseBuilder.html

try {
//connect to the database and get table "patient"

//dbConn is of type Database
//https://jackcess.sourceforge.io/apidocs/com/healthmarketscience/jackcess/Database.html
var dbConn = com.healthmarketscience.jackcess.DatabaseBuilder.open(new java.io.File("c:\\temp\\MirthDB.mdb"));

//https://jackcess.sourceforge.io/apidocs/com/healthmarketscience/jackcess/Table.html
var table = dbConn.getTable("patient");

//get table row count
var rowCnt = table.getRowCount();
logger.debug("Row Count" + rowCnt); //works

//https://jackcess.sourceforge.io/apidocs/com/healthmarketscience/jackcess/Cursor.html
var cursor = new com.healthmarketscience.jackcess.CursorBuilder.createCursor(table);
cursor.beforeFirst();

//reading a table: https://jackcess.sourceforge.io/cookbook.html#Reading_a_Table

for (var x=0; x < rowCnt; x++)
{
var row = cursor.getNextRow(); // Row[25:0][{patid=1,patfirstname=testfirst,patlastname=testlast,patdob=<null>,patgender=<null>}]
//logger.debug("row " + row.getId()); //25:0
logger.debug("row " + row.getInt("patid"));
logger.debug("row " + row.getString("patfirstname"));
}

return Col; //ResultSet or List<Map<String, Object>>
}

catch(error)
{
logger.error("Catching error: " + error);
}

finally {
if (dbConn) {
dbConn.close();
}
}

 Mirth 3.4.2 channel and sample Access database can be downloaded from my site.

Here is Mirth 3.4.2 download.

close
mirth_connect

Connect to MS Access from Mirth

Comments are closed.

ViSO Tech

ViSO Tech

Thank you for visiting! Click Facebook icon above and let's connect.
mirth_connect

Connect to MS Access from Mirth March 21, 2017

Search