我正在运行从 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