wso2 esb序列数据库更新

wso2 esb序列数据库更新,wso2,esb,wso2esb,orchestration,Wso2,Esb,Wso2esb,Orchestration,DBreport mediator输出语法错误,但我在SQL语句中看不到任何错误 <sequence xmlns="http://ws.apache.org/ns/synapse" name="_dbcount"> <dblookup> <connection> <pool> <password>1234</password> <use

DBreport mediator输出语法错误,但我在SQL语句中看不到任何错误

<sequence xmlns="http://ws.apache.org/ns/synapse" name="_dbcount">
   <dblookup>
      <connection>
         <pool>
            <password>1234</password>
            <user>root</user>
            <url>jdbc:mysql://localhost:3306/new_db</url>
            <driver>com.mysql.jdbc.Driver</driver>
         </pool>
      </connection>
      <statement>
         <sql>
            <![CDATA[            select * from consume where username= ? and id_api+ ?]]></sql>
            <parameter value="riccardo" type="VARCHAR" />
            <parameter value="1" type="INTEGER" />
            <result name="result_use" column="use" />
            <result name="result_user" column="username" />
         </statement>
      </dblookup>
      <dbreport>
         <connection>
            <pool>
               <password>1234</password>
               <user>root</user>
               <url>jdbc:mysql://localhost:3306/new_db</url>
               <driver>com.mysql.jdbc.Driver</driver>
               <property name="autocommit" value="false" />
            </pool>
         </connection>
         <statement>
            <sql>
               <![CDATA[UPDATE consume SET use=21 WHERE username='riccardo' AND id_api='1']]></sql>
            </statement>
         </dbreport>
         <log level="custom">
            <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="result for client" expression="get-property('result_user')" />
            <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="result for use" expression="get-property('result_use')" />
         </log>
      </sequence>
我的表格如下:

消费(int-id、varchar用户名、int-id\u-api、int-use) 用户(int-id、varchar用户名、varchar密码)

非常感谢

编辑我认为DBREPORT和DBLOOKUP中介在Mysql数据库上编写时存在一些主要问题,读取是可以的,但是更新和插入不起作用。。。 告诉我如果我错了努维奥

我认为这个问题的出现并不是因为DBReport中介中的某些错误。在查看报告的堆栈跟踪和序列配置时,我可以看到您已将“use”定义为列名。我不太清楚您是如何创建一个带有术语“use”的数据库列的,因为它是一个MySQL关键字,每当您在SQL查询中将关键字作为列或任何其他用户定义的属性时,MySQL查询编译器都应该抛出一个SQLException。用一个非关键字名称来代替“use”列可以解决您的问题

干杯,
Prabath

您知道如何在API manager中限制特定API的使用吗?不是限制层,而是限制用户Bob调用“API发送文本”10次并停止。我试图在“API SND文本”之前解决调用序列和代理的问题,但情况越来越糟,这些中介无法在MySql数据库中真正更新或插入任何内容,我认为这是一个主要错误。最好的办法是在API管理器中直接控制API的使用,但不知道如何…如果需要处理数据库以插入/更新和检索数据,请使用DataServices服务器。在API管理器中,控制部分使用节流完成。因此,当你发布API时,你应该选择不同的级别,允许用户使用特定的层。对不起,我不明白你所说的“限制用户Bob调用”API发送文本是什么意思“我的意思是允许Bob只发送20条消息,当他完成这些消息时,他就不能再使用该服务了。这与节流不同,因为节流的逻辑类似于“一分钟内调用3次”或“无限次”以及这样的工作人员……是的,谢谢,我已经意识到了这一点,但我通过为我的需求创建一个类中介来解决问题。无论如何,我会接受你的回答。谢谢
ERROR - DBReportMediator Error execuring insert statem
ent : UPDATE consume SET use='21' WHERE username='riccardo' AND id_api='1' again
st DataSource : jdbc:mysql://localhost:3306/new_db
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'use='21' WHERE username='riccardo' AND id_api=
'1'' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)...