web stats
Database Reader Source to Delimited Text Desitation - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2014, 03:06 AM
arazak arazak is offline
Mirth Newb
 
Join Date: May 2013
Location: Riyadh
Posts: 6
arazak is on a distinguished road
Default Database Reader Source to Delimited Text Desitation

Hi,

I have a table in SQL Server which is a queue of data to be forwarded to another system in delimited format.
Source Connector;

var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://localhost:1433/HL7DATA','mirthuser','password');

var sQuery = 'SELECT Top 1 [QueueID], [ReqID], [MessageText] FROM [HL7DATA].[dbo].[MessageQueue] WHERE ForwardedOn IS NULL ORDER BY QueuedOn';
var rs = dbConn.executeCachedQuery(sQuery);
var msgVal='';
rs.next()
msgVal = rs.getString('MessageText');

dbConn.close();
return msgVal;

Post-Process script;
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://localhost:1433/HL7DATA','mirthuser','password');

var rs = dbConn.executeCachedQuery('UPDATE MessageQueue SET ForwardedOn = GETDATE() WHERE QueueID=?',$(top1queueid));
dbConn.close();
------------------------------------------
Destination;

Template:
${message.encodedData}

-----------------------------------------------------
When i return the result set I'm getting the information in Destination in XML format, but the value in the column "MessageText" is delimited value. if i use variable to return the messgetext as above mirth raising the below error

[2014-06-16 13:28:26,065] ERROR (com.mirth.connect.connectors.jdbc.DatabaseReceive r:132): Failed to poll for messages from the database in channel "Fill Message"
com.mirth.connect.connectors.jdbc.DatabaseReceiver Exception: Unrecognized value returned from script in channel "Fill Message", expected ResultSet or List<Map<String, Object>>: javax.sql.rowset.serial.SerialClob@1db361c0
at com.mirth.connect.connectors.jdbc.DatabaseReceiver Script.poll(DatabaseReceiverScript.java:105)
at com.mirth.connect.connectors.jdbc.DatabaseReceiver .poll(DatabaseReceiver.java:112)
at com.mirth.connect.donkey.server.channel.PollConnec tor$PollConnectorTask.run(PollConnector.java:111)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)

Please help

Last edited by arazak; 06-16-2014 at 03:30 AM.
Reply With Quote
Reply

Tags
database reader, delimited text

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 01:43 PM.


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