我遇到了一些数据库问题,似乎无法找到解决此特定问题的解决方案。我正在尝试使用数据库中的表从数据库中获取信息,并将其与链接服务器上的表进行比较
[3/7/14 10:10:14:181 EST] 00000021 SystemErr R org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "EADWH02" was unable to begin a distributed transaction.
### The error may involve com.moog.app.weldlog.dao.mybatis.WeldLogMapping.listEmployee-Inline
### The error occurred while setting parameters
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "EADWH02" was unable to begin a distributed transaction.
以下是引发此错误的特定存储过程之一:
@workOrder varchar(25) = null,
@idPartNumber varchar(25) = null
begin
IF @workOrder is null
SELECT DISTINCT TOP 25 WO.WO_NBR, PARTS.PART_NBR
FROM EADWH02.MEDW.LBR.WO WO
JOIN EADWH02.MEDW.MFG.PARTS PARTS
ON PARTS.PART_KEY = WO.PART_KEY
AND PARTS.SRC_DB_KEY = WO.SRC_DB_KEY
WHERE (WO.WO_TYPE_KEY = '2' or WO.WO_TYPE_KEY = '3' or WO.WO_TYPE_KEY = '4' or WO.WO_TYPE_KEY = '5') and
(PARTS.PART_NBR like '' + @idPartNumber + '%')
ELSE IF @idPartNumber is null
SELECT DISTINCT TOP 25 WO.WO_NBR, PARTS.PART_NBR, dbo.getDescriptions(WO.WO_NBR) as strDescriptions
FROM EADWH02.MEDW.LBR.WO WO
JOIN EADWH02.MEDW.MFG.PARTS PARTS
ON PARTS.PART_KEY = WO.PART_KEY
AND PARTS.SRC_DB_KEY = WO.SRC_DB_KEY
WHERE ((WO.WO_TYPE_KEY = '2' or WO.WO_TYPE_KEY = '3' or WO.WO_TYPE_KEY = '4' or WO.WO_TYPE_KEY = '5') and
(WO.WO_NBR like '' + @workOrder))
ORDER BY WO.WO_NBR
end
((dbo.getDescriptions是一个标量值函数,工作正常))
这是我项目中的xml映射文件:
<select id="listWorkOrder" statementType="CALLABLE" parameterType="WorkOrder" resultMap="WorkOrderMap"> {
call listWorkOrder( #{workOrder, jdbcType=VARCHAR},
#{partNumber, jdbcType=VARCHAR})
}
</select>
任何人都知道是什么导致了这个错误?这个sql存储过程在我们正在使用的远程服务器和本地服务器上都会中断。谢谢你的帮助!