Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8511209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:55:33+00:00 2026-06-11T03:55:33+00:00

I have a problem with the DBreport mediator which output a syntax error, but

  • 0

I have a problem with the DBreport mediator which output a syntax error, but I can’t see any error in the SQL statement

<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>

The first DB lookup works fine but the second SQL statement in the DBreport cannot update the value:

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)...

My tables are as follows:

consume (int id, varchar username, int id_api, int use)
users (int id, varchar username, varchar password)

many thanks

EDIT I think there are major issues with DBREPORT AND DBLOOKUP mediators when writing on a Mysql DB, reading is fine, but Update and Insert just don’t work…
tell me if I am wrong

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:55:34+00:00Added an answer on June 11, 2026 at 3:55 am

    Nuvio,

    I think this issue arises not because of something wrong in the DBReport mediator. While going through the reported stack trace and the sequence configuration I can see you have defined “use” as a column name. I’m not quite sure how you created a database column with the term “use” because it is a MySQL keyword and MySQL query compiler should throw a SQLException whenever you have a keyword as a column or any other user defined attribute in your SQL query. Having a non-keyword name for in place of the column “use” would fix your problem.

    Cheers,
    Prabath

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem with Razor syntax and jQuery, I'm trying to append some items
I have problem adding markers into marker Clusterer of Google Maps. Firebug returns error:
I have problem with my Java program. How I read xml -file which has
I have problem in some JavaScript that I am writing where the Switch statement
I have problem on deleting component which is created on runtime. Please help me.
we have problem with slow insert statement using 40 bind variables as columns values.
I have problem with my SQL query. I try to eject these queries and
i have problem with my query! when this instruction is execute , this error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.