Sidebar

Getting "The server failed to resume the transaction" error.

+1 vote
4.0K views
asked May 20, 2016 by brandon-w-8204 (33,170 points)
edited May 20, 2016 by brandon-w-8204

NoResultsException: com.microsoft.sqlserver.jdbc.SQLServerException: The server failed to resume the transaction.

1 Answer

+2 votes

"The server failed to resume the transaction" means we are trying to use a connection that was left with an open sql statement. QIE 2.0.43 and higher requires that if you do a database connection not using doQuery or doConditionQuery then you close both the statement and the connection.Here is a code example of how to do this.

var connection = qie.getDbConnection('dbName');
var preparedStatement;
try {
   // prepare call
   try {
      preparedStatement= connection.prepareCall("someSqlCall");
      preparedStatement.setBigDecimal(1, 'somevalue');
      preparedStatement.execute();
   } finally {
      // Close the statement to avoid failed to resume transaction
      preparedStatement.close();
   }
} finally {
   // close the connection to avoid connection leaks
   connection.close();
}
answered May 20, 2016 by brandon-w-8204 (33,170 points)
...