com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update.

0
Hello community, I am trying to access the stored procedures from SQL Server DB. I am using Database Connector app store module. I have used Execute Statement java action. But when I try to run it, I am getting the below error. How can I resolve this. Please help me. An error has occurred while handling the request. [User 'MxAdmin' with session id '0e4e123b-cc23-419b-bea3-603d462223a3' and roles 'Administrator'] -------- com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update. at Texisle.IVK_StoredProcedure_Sample (JavaAction : 'Execute statement') Advanced stacktrace: at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:143) Caused by: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update. at com.mendix.core.component.InternalCore.execute(InternalCore.java:422) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update. at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:176) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update. at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:40) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:439) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:372) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1794) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:315) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) at databaseconnector.impl.JdbcConnector.executeStatement(JdbcConnector.java:94) at databaseconnector.actions.ExecuteStatement.executeAction(ExecuteStatement.java:72) at databaseconnector.actions.ExecuteStatement.executeAction(ExecuteStatement.java:1) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172) at com.mendix.core.component.InternalCore.execute(InternalCore.java:414) at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:52) at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172) at com.mendix.core.component.InternalCore.execute(InternalCore.java:414) at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:144) at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:312) at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:302) at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:302) at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:143) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:145) at scala.util.Try$.apply(Try.scala:192) at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:139) at akka.actor.Actor$class.aroundReceive(Actor.scala:465) at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:135) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) at akka.actor.ActorCell.invoke(ActorCell.scala:487) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) at akka.dispatch.Mailbox.run(Mailbox.scala:220) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Thanks in advance. Edited:   // This file was generated by Mendix Modeler. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package databaseconnector.actions; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import com.mendix.core.Core; import com.mendix.logging.ILogNode; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.systemwideinterfaces.core.IMendixObject; import com.mendix.systemwideinterfaces.core.meta.IMetaObject; import com.mendix.webui.CustomJavaAction; import databaseconnector.impl.JdbcConnector; /**  * <p>  * This Java action provides a consistent environment for Mendix projects to perform an arbitrary SELECT SQL query on relational external databases.  * JDBC (Java Database Connectivity) API, a standard Java API, is used when this Java action attempts  * to connect with a Relational Database for which a JDBC driver exists.  * The JDBC drivers for the databases you want to connect to, must be placed inside the userlib directory of a project.  * </p>  *   * Do not use this Java action for INSERT, UPDATE, DELETE or DDL queries.  * This action returns a list of Mendix objects based on the JDBC result set.  * The jdbcUrl argument must specify a database URL address that points to your relational database and is dependent  * upon the particular database and JDBC driver. It will always begin with "jdbc:" protocol, but the rest is up to particular vendor.  * For example 'jdbc:mysql://hostname/databaseName' jdbcUrl format can be used for MySQL databases.  * Note: Proper security must be applied as this action can allow SQL Injection in your Mendix application.  *   * @see    JdbcConnector  * @since  Mendix World 2016  * @param <String> jdbcUrl  *    A database URL address that points to your database.  *   * @param <String> userName   *    The user name for logging into the database, relative to the jdbcUrl argument.  *   * @param <String> password   *    The password for logging into the database, relative to the jdbcUrl argument.  *   * @param <String> sql  *    The SELECT query to be performed, relative to the database type.  *   * @param <IMendixObject> resultObject  *    An instance of the resulting object. This instance is used only for defining the type of object to be returned.  *   * @return <List<IMendixObject>>  *    SELECT Query result as a list of objects.  */ public class ExecuteQuery extends CustomJavaAction<java.util.List<IMendixObject>> {     private java.lang.String jdbcUrl;     private java.lang.String userName;     private java.lang.String password;     private java.lang.String sql;     private IMendixObject resultObject;     public ExecuteQuery(IContext context, java.lang.String jdbcUrl, java.lang.String userName, java.lang.String password, java.lang.String sql, IMendixObject resultObject)     {         super(context);         this.jdbcUrl = jdbcUrl;         this.userName = userName;         this.password = password;         this.sql = sql;         this.resultObject = resultObject;     }     @Override     public java.util.List<IMendixObject> executeAction() throws Exception     {         // BEGIN USER CODE         IMetaObject metaObject = resultObject.getMetaObject();         Stream<IMendixObject> resultStream = connector.executeQuery(             this.jdbcUrl, this.userName, this.password, metaObject, this.sql, this.getContext());         List<IMendixObject> resultList = resultStream.collect(Collectors.toList());         logNode.trace(String.format("Result list count: %d", resultList.size()));         return resultList;         // END USER CODE     }     /**      * Returns a string representation of this action      */     @Override     public java.lang.String toString()     {         return "ExecuteQuery";     }     // BEGIN EXTRA CODE     private final ILogNode logNode = Core.getLogger(this.getClass().getName());     private final JdbcConnector connector = new JdbcConnector(logNode);     // END EXTRA CODE }   This is the code in ExecuteQuery java class. Where should I change?  
asked
1 answers
0

It sounds like your stored procedure is returning a result set, but the code isn’t expecting that. This SO question might be helpful: https://stackoverflow.com/questions/22360730/sqlserverexception-a-result-set-was-generated-for-update 

answered