We help IT Professionals succeed at work.
Get Started

query mssql Database with mirth

Last Modified: 2012-05-10
I'm not very good at the programming aspect of my job.  Can someone look at this code and tell me where I'm screwing up?

I think I'm screwing up at tmp[blahblahblah] = result(1);

I know the field i'm grabbing from is a text field..
//see http://svn.sourceforge.net/viewvc/mirth/trunk/server/src/com/webreach/mirth/server/util/DatabaseConnection.java?view=markup 
var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://','username','password');

//the query
var AccNum = msg['tag00080050']['@tag'].toString();
var expression = "SELECT REPORT_TEXT FROM PACS_T_REPORT_TEXT WHERE EXAM_KEY = '" + AccNum + "';";  

//see http://developers.sun.com/prodtech/javatools/jscreator/reference/docs/apis/rowset/com/sun/rowset/CachedRowSetImpl.html
var result = dbConn.executeCachedQuery(expression); 

//go to the first result
//get the value from the first colum as an integer

tmp['OBX']['OBX.5']['OBX.5.1'] = result(1);


Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE