1 //Create Connection, insert 1 tuple, call rollback. Repeat the steps(connec,insert,rollback) for 10K times.
2 //Then connect and check whether 0 tuples are present.
5 public class ConnTest29
7 public static void main(String
[] args
)
11 Class
.forName("csql.jdbc.JdbcSqlDriver");
12 Connection con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
13 con
.setAutoCommit(false);
14 Statement cStmt
= con
.createStatement();
15 PreparedStatement stmt
= null;
17 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 char (20));");
20 for (int i
=0; i
<10000; i
++)
22 con
= DriverManager
.getConnection("jdbc:csql","root","manager");
23 con
.setAutoCommit(false);
24 stmt
= con
.prepareStatement("INSERT INTO T1 VALUES(?,?);");
26 stmt
.setString(2,"xieliangkingsoft");
27 ret
= stmt
.executeUpdate();
30 System
.out
.println("test failed");
37 con
= DriverManager
.getConnection("jdbc:csql","root","manager");
39 cStmt
= con
.createStatement();
40 ResultSet rs
= cStmt
.executeQuery("SELECT * from T1;");
46 System
.out
.println("Total rows selected " + count
);
47 cStmt
.execute("DROP TABLE T1;");
50 if (count
== 0) System
.exit(0); else System
.exit(1);
52 System
.out
.println("Exception in Test: "+e
);