Data Service insert problem

amir sohei jazayeri's picture
Hi, I've faced some problems in creating a data service that uses an insert sql statement. The error is produced because instead of "updateQuery" method, "executeQuery" method is called. The JDBC exception is "Can not issue data manipulation statements with executeQuery()". This problem does not exists in Data Service Application Server, so I am wondering why this problem exists in WSAS, or may be I made a mistake in creating data service in WSAS. Any information is helpful. Thanks.
charitha's picture

Hi, Could you please post

Hi, Could you please post your *.dbs so that we can check whether there are any issues? Regards Charitha
amir sohei jazayeri's picture

dbs source

Hello Charitha, Thanks for your reply. I use wsas 3.1.3, my db is MySQL. This is my dbs: <?xml version="1.0" encoding="UTF-8"?> <data name="MySQL">     <config id="mysql">         <property name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property>         <property name="org.wso2.ws.dataservice.protocol">jdbc:mysql://127.0.0.1:3306/test</property>         <property name="org.wso2.ws.dataservice.user">root</property>         <property name="org.wso2.ws.dataservice.password">123456</property>         <property name="org.wso2.ws.dataservice.minpoolsize"/>         <property name="org.wso2.ws.dataservice.maxpoolsize"/>         <property name="org.wso2.ws.dataservice.autocommit"/>     </config>     <query id="Test" useConfig="mysql">         <sql>Insert into tmp values(?,?,?)</sql>         <result element="Results" rowName="Result" defaultNamespace=""/>         <param name="id" sqlType="INTEGER"/>         <param name="name" sqlType="STRING"/>         <param name="value" sqlType="STRING"/>     </query>     <operation name="t">         <call-query href="Test">             <with-param name="id" query-param="id"/>             <with-param name="name" query-param="name"/>             <with-param name="value" query-param="value"/>         </call-query>     </operation> </data>    
amir sohei jazayeri's picture

DataService

Hi again, I've tested similar data service in Data Service Application Server 2.2.0, unfortunately this problem existed there too. But I do not find any solution or workaround. Thanks
inc211's picture

Solution

Hi, did you get a soultion until now? The problem is, that you define a <result>-element: <result element="Results" rowName="Result" defaultNamespace=""/> So the system assumes, that you have to return values and performs a 'executeQuery' So, simply omit the 'result'-element. Best regards Dieter
sameerkumar15.gmail.com's picture

Return value from insert/update sql in wso2 data service

    I want to capture return value from insert/update query. Please let me know, how can I do this. I have following dbs, which is inserting properly. But how will I know, if insert/update is success.   <data name="TestDS">    <config id="testId">       <property name="org.wso2.ws.dataservice.driver">org.postgresql.Driver</property>       <property name="org.wso2.ws.dataservice.protocol">jdbc:postgresql://127.0.0.1:5432/</property>       <property name="org.wso2.ws.dataservice.user">postgres</property>       <property name="org.wso2.ws.dataservice.password">root</property>    </config>    <query id="testQuery2" useConfig="testId">       <sql>insert into employee values(:id,:name,:address)</sql>         <param name="id" sqlType="STRING" ordinal="1" /> <param name="name" sqlType="STRING" ordinal="2" /> <param name="address" sqlType="STRING" ordinal="3" />    </query>        <operation name="getEmployees2">       <call-query href="testQuery2" />    </operation>  
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)