SQLServerException: The server failed to resume the transaction. Desc:ab00000002

public void runSp(List<String> params, DataSource dataSource, String spName) throws SQLException {
  StringBuffer sb = new StringBuffer("{call " + spName + " (");
  for (int i = 0; i < params.size() - 1; i++) {
    sb.append("?,");
  }
  sb.append("?)}");
  String callString = sb.toString();
  LOGGER.info("[runSp] Running statement: " + callString);
  Connection conn = getConnection(dataSource);
  conn.setAutoCommit(false);
  CallableStatement cs = conn.prepareCall(callString);
  for (int i = 0; i < params.size(); i++) {
    cs.setString(i + 1, params.get(i));
  }
  try {
    cs.execute();
    conn.commit();
    LOGGER.info("sp completed successfully");
  } catch (Exception e) {
    LOGGER.info("sp failed", e);
    conn.rollback();
  } finally {
    cs.close();
    conn.close();
  }
}

This exception is thrown when the method is called while the program is running. The program needs to call SQL Server’s stored procedure during the run, but there is already a commit of the item in the store.
I also added Java code to Java code to throw out this one. After I tried to remove control from the Java code, there were no errors. The specific reasons are still in the learning process, I hope you can give me some advice.

Read More: