[英]Execute MSSQL stored procedure in Mule CE 3.5 (Anypoint)
在Mule CE 3.5(任何点IDE)中执行MSSQL存储过程时,出现错误消息。
********************************************************************************
Message : Query type must me '[STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Query type must me '[STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException)
org.mule.module.db.internal.processor.AbstractDbMessageProcessor:164 (null)
2. Query type must me '[STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/cur...)
这是我的代码。
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<db:generic-config name="db2_Database_Configuration" url="jdbc:sqlserver://localhost:1700;databaseName=db2;user=user;password=password;" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic Database Configuration"/>
<flow name="DB_MSSQLFlow2" doc:name="DB_MSSQLFlow2">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="DB_MSSQL/sp" doc:name="HTTP"/>
<db:stored-procedure config-ref="db2_Database_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[EXEC GetAllJobs;]]></db:parameterized-query>
</db:stored-procedure>
</flow>
</mule>
但是,存储过程“ GetAllJobs”可以在SQL Server Management Studio上执行而不会出现问题。
请帮助...存储过程的问题是什么,与普通的SQL select一样,带参数的工作正常吗?
谢谢,
卡林
在您的流程中尝试此<db:parameterized-query>{ call GetAllJobs }</db:parameterized-query>
,这样您的流程将如下所示:-
<db:generic-config name="db2_Database_Configuration" url="jdbc:sqlserver://localhost:1700;databaseName=db2;user=user;password=password;" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic Database Configuration"/>
<flow name="DB_MSSQLFlow2" doc:name="DB_MSSQLFlow2">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="DB_MSSQL/sp" doc:name="HTTP"/>
<db:stored-procedure config-ref="db2_Database_Configuration" doc:name="Database">
<db:parameterized-query>{ call GetAllJobs }</db:parameterized-query>
</db:stored-procedure>
</flow>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.