Package java.sql

Examples of java.sql.Connection.rollback()


        stat.execute("create index idx_name on test(name, id)");
        stat.execute("insert into test select x, x || space(200 * x) from system_range(1, 10)");
        conn.setAutoCommit(false);
        stat.execute("delete from test where id > 5");
        stat.execute("backup to '" + getBaseDir() + "/backup.zip'");
        conn.rollback();
        Restore.execute(getBaseDir() + "/backup.zip", getBaseDir(), "pageStore2", true);
        Connection conn2;
        conn2 = getConnection("pageStore2");
        Statement stat2 = conn2.createStatement();
        assertEqualDatabases(stat, stat2);
View Full Code Here


        System.out.println("create--- " + count + " " + defaultValue);
        stat.execute("create table test(id int, name varchar default " + defaultValue + " )");
        System.out.println("insert---");
        stat.execute("insert into test(id) select x from system_range(1, "+count+")");
        System.out.println("rollback---");
        conn.rollback();

        System.out.println("drop---");
        stat.execute("drop table test");
        System.out.println("create---");
        stat.execute("create table test(id int primary key, name varchar default " + defaultValue + " )");
View Full Code Here

            if (now > time + 5000) {
                System.out.println(i);
                time = now + 5000;
            }
        }
        conn.rollback();
        conn.close();
    }

}
View Full Code Here

         }
      }
      catch (Exception e) {
         if (conn != null) {
            try {
               conn.rollback();
            }
            catch (SQLException ex) {
            }
            this.dbPool.erase(conn);
            conn = null;
View Full Code Here

      }
      catch (XmlBlasterException ex) {
         success = false;
         try {
            if (!conn.getAutoCommit())
               conn.rollback();
         }
         catch (Throwable e) {
            log.severe("tablesCheckAndSetup: exception occured when rolling back: " + e.toString());
         }
         throw ex;
View Full Code Here

      }
      catch (Throwable ex) {
         success = false;
         try {
            if (conn != null && !conn.getAutoCommit())
               conn.rollback();
         }
         catch (Throwable e) {
            log.severe("tablesCheckAndSetup: exception occured when rolling back: " + e.toString());
         }
View Full Code Here

       }
      catch (Throwable ex) {
         success = false;
         try {
            if (!conn.getAutoCommit()) {
               conn.rollback(); // rollback the original request ...
               conn.setAutoCommit(true); // since if an exeption occurs it infects future queries within the same transaction
            }
         }
         catch (Throwable ex1) {
            log.severe("error occured when trying to rollback after exception: reason: " + ex1.toString() + " original reason:" + ex.toString());
View Full Code Here

      }
      catch (Throwable ex) {
         success = false;
         try {
            if (conn != null)
               conn.rollback();
         }
         catch (Throwable ex1) {
            success = false;
            log.severe("wipeOutDB: exception occurred when rolling back: " + ex1.toString());
         }
View Full Code Here

         }
         finally {
            if (conn != null) {
               if (needRollback && !keepTransactionOpen) {
                  try {
                     conn.rollback();
                     log.fine("Transaction rolled back");
                  }
                  catch (Throwable ex) {
                     log.severe("store: an exception occured when trying to rollback: " + ex.getMessage());
                     log.severe(Global.getStackTraceAsString(ex));
View Full Code Here

            if (log.isLoggable(Level.FINE))
               log.fine("' " + req + "'");
            count +=  update(req, conn);
         }
         if (count != uniqueIds.length)
            conn.rollback(); // not all entries have been deleted:
                             // will be handled individually below (to know which is deleted and which not)
         else {
            if (!conn.getAutoCommit()) conn.commit();
            boolean[] ret = new boolean[uniqueIds.length];
            for (int i=0; i < ret.length; i++) ret[i] = true;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.