I can't generate input mappings for a SQL query in a data service. Input Mapping setting
When I make the call I got this error:
[2024-01-02 11:24:11,955] ERROR {DBInOnlyMessageReceiver} - Error in in-only message receiver 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.processPreNormalQuery': 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 ':FirstName,:LastName,:Email,:Salary)' at line 1
DS Code: DATABASE_ERROR
Source Data Service:-
Name: RDBMSDataService
Location: C:\IntegrationStudio\runtime\microesb\tmp\carbonapps-1234\1704191032756TestCompositeApplication_1.0.0.car\RDBMSDataService_1.0.0\RDBMSDataService-1.0.0.dbs
Description: maria db data service example
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _post_employees
Current Params: {Salary=10000, [email protected], FirstName=Marchino, LastName=Smith}
Nested Exception:-
java.sql.SQLSyntaxErrorException: 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 ':FirstName,:LastName,:Email,:Salary)' at line 1at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:117)
at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:66)
at org.wso2.micro.integrator.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:368)
at org.wso2.micro.integrator.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:40)
at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:52) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:379) at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:438) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:186) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
I tried to add the ' and " to the dynamic fields making the query, like this:
INSERT INTO `employees`(`FirstName`, `LastName`, `Email`, `Salary`)
VALUES (':FirstName', ':LastName', ':Email', ':Salary')
and
INSERT INTO `employees`(`FirstName`, `LastName`, `Email`, `Salary`)
VALUES (":FirstName", ":LastName", ":Email", ":Salary")
Also tried to create the mapping manually using the "Add new" blue button without success.