简体   繁体   English

Mirth Database Reader 无法处理从通道中的数据库检索到的行(索引超出范围)?

[英]Mirth Database Reader failed to process row retrieved from the database in channel (index out of range)?

I have a Mirth (v3.10) Database Reader channel source that grabs some test records (from an SQL Server source) using the query...我有一个 Mirth (v3.10) Database Reader 通道源,它使用查询获取一些测试记录(来自 SQL 服务器源)...

select * 
  from [mydb].[dbo].[lab_test_MIRTHTEST_001]
  where orc_2_1_placer_order_number 
  in (
  'testid_001', 'testid_002', 'testid_003'
  )

Even though the channel appears to function properly and messages are getting written to the channel destination, I am seeing SQL errors in the server logs in the dashboard when deploying the channel:即使通道正确显示为 function 并且消息正在写入通道目标,我在部署通道时在仪表板中的服务器日志中看到 SQL 错误:

[2020-12-16 08:16:28,266]  ERROR  (com.mirth.connect.connectors.jdbc.DatabaseReceiver:268): Failed to process row retrieved from the database in channel "MSSQL2SFTP_TEST"
com.mirth.connect.connectors.jdbc.DatabaseReceiverException: com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is out of range.
    at com.mirth.connect.connectors.jdbc.DatabaseReceiverQuery.runPostProcess(DatabaseReceiverQuery.java:233)
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver.processRecord(DatabaseReceiver.java:260)
    ...

I can run this query fine in the SQL Server Mgmt Studio itself (and the messages seem to be transmitting fine), so not sure why this error is popping up but am concerned there is something I'm missing here.我可以在 SQL Server Mgmt Studio 本身中很好地运行此查询(并且消息似乎可以正常传输),因此不确定为什么会弹出此错误,但我担心这里缺少一些东西。

Anyone with more experience know what is going on here?有更多经验的人知道这里发生了什么吗? How to fix?怎么修?

The issue looks to be in the post-process SQL section of the Database Reader, so it makes sense that the messages appear to be working.该问题似乎出在数据库读取器的后处理 SQL 部分中,因此消息似乎正在工作是有道理的。

Did you intend to enable the post-process section at the bottom of your source tab?您是否打算启用源选项卡底部的后期处理部分?

Kindly share the code that you are using to process data in the result set.请分享您用于处理结果集中数据的代码。 In the meantime, you can consider the code below as a staring point.同时,您可以将下面的代码视为起点。 You can place this in Javascript transformer step in the source connector of your channel.您可以将它放在通道源连接器中的 Javascript 变压器步骤中。

//Declaring variables to hold column values returned from the result set
var variable1;
var variable2;

//defining the sql read command
var  Query = "select * from [mydb].[dbo].[lab_test_MIRTHTEST_001]";
Query += " where orc_2_1_placer_order_number in";
Query += " ('testid_001', 'testid_002', 'testid_003')";

var result = dbconn.executeCachedQuery(Query);  
//where dbconn is your database connection string

//looping through the results
while(result.next())
{
    
variable1=result.getString("variable1");
variable2 = result.getString("variable2");
    
}

//optionally place the returned values in a channel map for use later
$c('variable1',variable1);
$c('variable2',variable2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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