Package java.sql

Examples of java.sql.Connection.commit()


    });
    ConnectionEventListener cel = Mockito.mock(ConnectionEventListener.class);
    xaConn.addConnectionEventListener(cel);
    Connection c = xaConn.getConnection();
    try {
      c.commit();
    } catch (SQLException e) {
     
    }
    Mockito.verify(cel).connectionErrorOccurred((ConnectionEvent) Mockito.anyObject());
  }
View Full Code Here


        Statement stat = conn.createStatement();
        stat.execute("SET WRITE_DELAY 0");
        conn.setAutoCommit(false);
        stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)");
        stat.execute("INSERT INTO TEST VALUES(1, 'Hello')");
        conn.commit();
        stat.execute("INSERT INTO TEST VALUES(2, 'World')");
        stat.execute("PREPARE COMMIT XID_TEST_TRANSACTION_WITH_LONG_NAME");
        crash(conn);
    }
}
View Full Code Here

                conn.setAutoCommit(false);
                int len = getSize(3, 100);
                for (int j = 0; j < len; j++) {
                    stat.execute("INSERT INTO TEST VALUES(" + j + ", 'Hello')");
                    if (random.nextInt(5) == 0) {
                        conn.commit();
                    }
                    if (random.nextInt(10) == 0) {
                        stat.execute("DROP TABLE IF EXISTS TEST");
                        stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
                    }
View Full Code Here

            stat.execute("CREATE TABLE IF NOT EXISTS TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
            state = 1;
            conn.setAutoCommit(false);
            stat.execute("INSERT INTO TEST VALUES(1, 'Hello')");
            stat.execute("INSERT INTO TEST VALUES(2, 'World')");
            conn.commit();
            state = 2;
            stat.execute("UPDATE TEST SET NAME='Hallo' WHERE ID=1");
            stat.execute("UPDATE TEST SET NAME='Welt' WHERE ID=2");
            conn.commit();
            state = 3;
View Full Code Here

            stat.execute("INSERT INTO TEST VALUES(2, 'World')");
            conn.commit();
            state = 2;
            stat.execute("UPDATE TEST SET NAME='Hallo' WHERE ID=1");
            stat.execute("UPDATE TEST SET NAME='Welt' WHERE ID=2");
            conn.commit();
            state = 3;
            stat.execute("DELETE FROM TEST WHERE ID=1");
            stat.execute("DELETE FROM TEST WHERE ID=2");
            conn.commit();
            state = 1;
View Full Code Here

            stat.execute("UPDATE TEST SET NAME='Welt' WHERE ID=2");
            conn.commit();
            state = 3;
            stat.execute("DELETE FROM TEST WHERE ID=1");
            stat.execute("DELETE FROM TEST WHERE ID=2");
            conn.commit();
            state = 1;
            stat.execute("DROP TABLE TEST");
            state = 0;
            if (init) {
                maxPowerOffCount = Integer.MAX_VALUE - ((JdbcConnection) conn).getPowerOffCount();
View Full Code Here

            }
          } catch (Throwable t) {
          }
        }
      }
      conn.commit();
      conn.setAutoCommit(saved_auto_commit);
      return Any.TRUE;
     
    } catch (IOException e) {
      throw context.exception(e);
View Full Code Here

            st.setString(2, "name02_" + i);
            st.setBinaryStream(3, bais, blob.length);
            st.addBatch();
         }
         st.executeBatch();
         conn.commit();
         long t1 = System.currentTimeMillis();
         long dt = t1-t0;
         log.info("batch statements='" + nmax + "' took '" + dt + "' ms (per statement: " + dt/nmax + ")");
         pool.update("delete from PERFORM");
         conn.commit();
View Full Code Here

         conn.commit();
         long t1 = System.currentTimeMillis();
         long dt = t1-t0;
         log.info("batch statements='" + nmax + "' took '" + dt + "' ms (per statement: " + dt/nmax + ")");
         pool.update("delete from PERFORM");
         conn.commit();
      }
      {
         long t0 = System.currentTimeMillis();
         for (int i=0; i < nmax; i++) {
            ByteArrayInputStream bais = new ByteArrayInputStream(blob);
View Full Code Here

            st.setString(1, "name01_" + i);
            st.setString(2, "name02_" + i + "_hhjdhsdsdjsdkljsdjsdljljsdljsdkljsljsdsdsdsd");
            st.setBinaryStream(3, bais, blob.length);
            st.execute();
         }
         conn.commit();
         long t1 = System.currentTimeMillis();
         long dt = t1-t0;
         log.info("non-batch (single commit) statements='" + nmax + "' took '" + dt + "' ms (per statement: " + dt/nmax + ")");
         pool.update("delete from PERFORM");
         conn.commit();
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.