Bсем привет хочу удалить по id два таблиц который не взаимадествонный. Выдает такая ошибка Call getNextException to see other errors in the batch
import lombok.SneakyThrows;
import java.sql.*;
public class ExecuteBatchSQL {
public static void main(String[] args) throws SQLException {
String sid = "S7";
String pid = "P7";
String deleteStable = "DELETE FROM s WHERE sid = " + sid;
String deletPtable = "DELETE FROM p WHERE pid = "+pid;
Connection connection = null;
Statement statement = null;
try {
connection = DriverManager.getConnection(url, username, password);
connection.setAutoCommit(false);
statement = connection.createStatement();
statement.addBatch(deleteStable);
statement.addBatch(deletPtable);
var ints = statement.executeBatch();
connection.commit();
} catch (Exception e) {
if (connection != null) {
connection.rollback();
}
throw e;
} finally {
if (connection != null) {
connection.close();
}
if (statement != null) {
statement.close();
}
}
}
}