Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void updateNoAutoCommitDB(LinkedList<String> queries) throws SQLException {
- Statement stmt = null;
- try {
- connection.setAutoCommit(false);
- stmt = connection.createStatement();
- for(String query : queries){
- stmt.executeUpdate(query);
- }
- connection.commit();
- connection.setAutoCommit(true);
- } catch (SQLException e) {
- try {
- connection.rollback();
- connection.setAutoCommit(true);
- throw e;
- } catch (SQLException e1) {
- System.out.println("VIDINĖ KLAIDA: Nenumatyta SQL klaida!");
- }
- } finally {
- try {
- if(stmt != null) stmt.close();
- } catch (SQLException e) {
- System.out.println("VIDINĖ KLAIDA: Nenumatyta SQL klaida!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement