简体   繁体   中英

How to avoid stored procedure call to SQL database from Mirth Connet

I've a requirement in Mirth Connect to call take number of parameters (max 10) from incoming HL7 message and call a stored procedure to retrieve the data from the SQL database. Currently this stored procedure is being called for each single message.

I'm looking for best option to replace this database call.

Sounds like you might want to refactor the function of your stored procedure into the mirth channel itself. You can use the jdbc mysql driver to execute any queries and use javascript to handle the results and perform the same tasks that your stored procedure provides. Hope this helps

var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/YOURDB','username','password');
var query = "SELECT PatientID FROM YOURTABLENAME " + "WHERE Last = '" + $('lname')+ "'";
var result = dbConn.executeCachedQuery( query );

result.next();
var patientID = result.getString(1)
//logger.info(result.getString(1));
result.close();

var query = "INSERT INTO YOURTABLENAME (id, name) VALUES ('"+patientID+"','"+$('lname')+"')";
var result = dbConn.executeUpdate( query );

dbConn.close(); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM