Announcement

Collapse
No announcement yet.

Database Reader Source to Delimited Text Desitation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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>>: [email protected]
    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, 02:30 AM.
Working...
X