db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravinder Reddy <pand...@students.iiit.ac.in>
Subject Help needed in rollback behavior
Date Thu, 05 Jul 2007 18:05:06 GMT

 	hi,
 		The following test fixture is failing when run under junit.

public void testRollbackBehavior() throws SQLException	{
 		Statement s = createStatement();
  s.executeUpdate("DECLARE GLOBAL TEMPORARY TABLE SESSION.t2(c21 int, c22 int) not logged");
  PreparedStatement pStmt = prepareStatement("insert into SESSION.t2 values (?, ?)");
 		pStmt.setInt(1, 21);
 		pStmt.setInt(2, 1);
 		pStmt.execute();
 		pStmt.close();
 		ResultSet rs1 = s.executeQuery("select * from SESSION.t2");
 		rs1.next();
 	assertEquals(21 , rs1.getInt(1));
 	assertEquals(1 , rs1.getInt(2));
 		rs1.close();
 		rollback();//RollBack
 	//Now select from SESSION.t2 should fail
 	assertStatementError("42X05" , s , "select * from SESSION.t2");
 		s.close();
}
 	After rollback() is called , I am expecting that the table
SESSION.t2 is no longer available and hence I asserted it to assertStatementError("42X05......)
But the fixture is failed as the statement "select * from SESSION.t2" is not giving any error
and it is executed as normally meaning the table SESSION.t2 was not dropped.
 	I have setted getConnection().setAutoCommit(false); in the setUp() 
method.
 	what's wrong with the code.?.can anybody there help in this plzz.

Thanks in advance.
  -- 
******************************************************************************

    Every problem that has been solved can be solved again in a better way

                                                   - Ravinder Reddy

*******************************************************************************


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Mime
View raw message