Pobierz zestaw wyników za pomocą CallableStatement po executeBatch ()
Muszę wywoływać procedurę przechowywaną wiele razy i używaćexecuteBatch()
dla tego. Każde wywołanie powinno zwrócić tabelę z wynikami, ale nie mogłem uzyskać dostępu do tych wyników. Następny kod działa poprawnie:
callableStatement.setString(1, "foo");
callableStatement.setString(2, "bar");
callableStatement.execute();
resultSet = callableStatement.getResultSet();
Ale następny kod nie działa zgodnie z oczekiwaniami:
for (String str : strings) {
callableStatement.setString(1, str);
callableStatement.setString(2, "bar");
callableStatement.addBatch();
}
callableStatement.executeBatch();
resultSet = callableStatement.getResultSet(); // returns null
Próbowałem już zadzwonićcallableStatement.getUpdateCount()
icallableStatement.getMoreResults()
przed wyodrębnieniem ResultSet, ale bezskutecznie.