1 //Test 100 statements, inserting 1 tuple, committed in 1 transaction, check whether total tuples is 100
6 public static void main(String
[] args
)
10 Class
.forName("csql.jdbc.JdbcSqlDriver");
11 Connection con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
12 Statement cStmt
= con
.createStatement();
14 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 char (20));");
16 PreparedStatement stmt
[] = new PreparedStatement
[100];
17 for (int i
=0; i
<100 ; i
++)
19 stmt
[i
] = con
.prepareStatement("INSERT INTO T1 VALUES (?, ?);");
20 if (i
%10 ==0) System
.out
.println("statements prepared "+ i
);
22 for (int i
=0; i
<100 ; i
++)
25 stmt
[i
].setString(2, String
.valueOf(i
+100));
26 ret
= stmt
[i
].executeUpdate();
32 cStmt
= con
.createStatement();
33 System
.out
.println("Listing tuples:");
34 ResultSet rs
= cStmt
.executeQuery("SELECT * from T1;");
42 cStmt
.execute("DROP TABLE T1;");
44 if (count
== 100) System
.exit(0); else System
.exit(1);
46 System
.out
.println("Exception in Test: "+e
);