web stats
Querying DB2 Database - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-07-2010, 02:51 PM
TSmithTRA TSmithTRA is offline
OBX.2 Kenobi
 
Join Date: Nov 2009
Location: Winston-Salem, NC
Posts: 79
TSmithTRA is on a distinguished road
Default Querying DB2 Database

I would appreciate any help anyone could offer. I am querying a DB2 database for information and getting back some unexpected results.

var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.ibm.db2.jcc.DB2Driver','jdbc:db2://10.207.255.100:50000/DBName','XXXXX','abc123');
var traSQLGetInstitution = 'select institution from dicom.study where accessionnumber = ';
traSQLGetInstitution +="'";
traSQLGetInstitution += msg['ORC']['ORC.2']['ORC.2.1'].toString();
traSQLGetInstitution +="'";
var Institution = dbConn.executeCachedQuery(traSQLGetInstitution);
channelMap.put("traSQLGetInstitution",traSQLGetIns titution);
channelMap.put("Institution",Institution);
dbConn.close();

This is the result I get
com.sun.rowset.CachedRowSetImpl@1319aa9

Can anyone help me understand what tis is or how I can get the information out of the database?

If I run the Query standalone on the DB2 server from the DB2 command line it works.

Any help would be appreciated.
Reply With Quote
  #2  
Old 01-07-2010, 04:18 PM
TSmithTRA TSmithTRA is offline
OBX.2 Kenobi
 
Join Date: Nov 2009
Location: Winston-Salem, NC
Posts: 79
TSmithTRA is on a distinguished road
Default Found the error an corrected it

var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.ibm.db2.jcc.DB2Driver','jdbc:db2://10.207.255.100:50000/DBName','XXXXX','abc123');
var traSQLGetInstitution = 'select institution from dicom.study where accessionnumber = ';
traSQLGetInstitution +="'";
traSQLGetInstitution += msg['ORC']['ORC.2']['ORC.2.1'].toString();
traSQLGetInstitution +="'";
var Results=0;
Results = dbConn.executeCachedQuery(traSQLGetInstitution);
dbConn.close();
Results.first();
Institution=Results.getString(1);
channelMap.put("traSQLGetInstitution",traSQLGetIns titution);
channelMap.put("Institution",Institution);

Returned result set is now
PIC-CT-01
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:18 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation