我正在运行从WSO2 DSS到Cassandra数据库的插入示例。
这是我的带有Casandra数据库插入配置的DSS。
<data name="Cdno">
<config id="insert">
<property name="url">jdbc:cassandra://localhost:9160/employee</property>
<property name="driverClassName">org.apache.cassandra.cql.jdbc.CassandraDriver</property>
</config>
<query id="Insertinto" useConfig="insert">
<sql>INSERT INTO employee.dept(eno,dno) values(?,?)</sql>
<result element="Body" rowName="Datalist">
<element column="eno" name="eno" xsdType="integer"/>
<element column="dno" name="dno" xsdType="integer"/>
</result>
<param name="eno" ordinal="1" sqlType="INTEGER"/>
<param name="dno" ordinal="2" sqlType="INTEGER"/>
</query>
<operation name="insertinto">
<call-query href="Insertinto">
<with-param name="eno" query-param="eno"/>
<with-param name="dno" query-param="dno"/>
</call-query>
</operation>
</data>
当我从DSS插入数据时,请尝试将此服务提供给Cassandra 数据库,我收到以下错误。我怎样才能做到这一点。
DS Code: DATABASE_ERROR
Source Data Service:-
Name: Cdno
Location: /Cdno.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: insertinto
Current Params: {eno=5, dno=6}
Nested Exception:-
java.sql.SQLSyntaxErrorException: Expected key 'KEY' to be present in WHERE clause for 'dept'
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
... 38 more
答案 0 :(得分:0)
在cassandra中插入数据时,您也应该传递密钥信息。 查看sample
答案 1 :(得分:0)
WSO2正在生成无效请求。我不认为除了报告错误之外你还能做很多事情。