gpt4 book ai didi

cassandra - 如何将参数传递给 WSO2 DSS 中的 Cassandra CQL 查询

转载 作者:行者123 更新时间:2023-12-02 22:18:43 31 4
gpt4 key购买 nike

我一直在尝试让参数化的 CQL 查询在 WSO2 DSS 中工作。不幸的是我没有成功。感谢您在我遇到紧急问题时尽快提供帮助。

以下是DBS文件内容

<data name="CassParamTest">
<config id="CassDs">
<property name="org.wso2.ws.dataservice.protocol">jdbc:cassandra://localhost:9161/oneDataAux</property>
<property name="org.wso2.ws.dataservice.driver">org.apache.cassandra.cql.jdbc.CassandraDriver</property>
</config>
<query id="getEmps" useConfig="CassDs">
<sql>select employeeNumber from EMPLOYEES where employeeNumber = :employeeNumber</sql>
<param name="employeeNumber" sqlType="STRING" />
</query>
<operation name="getEmps">
<call-query href="getEmps">
<with-param name="employeeNumber" query-param="employeeNumber" />
</call-query>
</operation>
</data>

其实参数employeeNumber是一个Number。但我一直收到错误。所以我也尝试使用 String 但无济于事。我也试过?而不是命名参数

这是我得到的错误。

当参数为字符串时,

<soapenv:Fault xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:axis2ns12="http://ws.wso2.org/dataservice">
<soapenv:Code>
<soapenv:Value>axis2ns12:DATABASE_ERROR</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US" xmlns:xml="http://www.w3.org/XML/1998/namespace">DS Fault Message: Error in DS non result invoke.
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: CassParamTest
Location: /CassParamTest.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: getEmps
Current Params: {employeeNumber=1002}
Nested Exception:-
java.sql.SQLNonTransientException: No Update Count was returned from the CQL statement passed in an 'executeUpdate()' method

</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<axis2ns11:DataServiceFault xmlns:axis2ns11="http://ws.wso2.org/dataservice">DS Fault Message: Error in DS non result invoke.
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: CassParamTest
Location: /CassParamTest.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: getEmps
Current Params: {employeeNumber=1002}
Nested Exception:-
java.sql.SQLNonTransientException: No Update Count was returned from the CQL statement passed in an 'executeUpdate()' method

</axis2ns11:DataServiceFault>
</soapenv:Detail>
</soapenv:Fault>

当参数为数字时,

DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: CassParamTest
Location: /CassParamTest.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: getEmps
Current Params: {employeeNumber=1002}
Nested Exception:-
java.sql.SQLException: Mismatched types: java.math.BigInteger cannot be cast to java.lang.String

感谢您的宝贵时间和帮助

最佳答案

我找到了解决方案。我错过了输出映射。似乎如果不存在输出映射,DSS 会将命令作为更新命令(参见 http://docs.wso2.org/wiki/display/DSS301/Cassandra)

关于cassandra - 如何将参数传递给 WSO2 DSS 中的 Cassandra CQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14058564/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com