1 //close() and then execute INSERT/QUERY/UPDATE statement. It should fail
5 public static void main(String
[] args
)
9 Class
.forName("csql.jdbc.JdbcSqlDriver");
10 Connection con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
11 Statement cStmt
= con
.createStatement();
12 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 char (20));");
13 cStmt
.execute("CREATE INDEX IDX ON T1 ( f1);");
17 //after close the connection,execute "INSERT" statement,it should fail
20 cStmt
.execute("INSERT INTO T1 VALUES (1, 'FIRST');");
25 System
.out
.println("insert exception---" + e
.getMessage());
28 //after close the connection,execute "QUERY" statement,it should fail
31 cStmt
.executeQuery("SELECT * from T1 where f1 = 1;");
36 System
.out
.println("query exception---" + e
.getMessage());
39 //after close the connection,execute "UPDATE" statement,it should fail
42 cStmt
.executeUpdate("UPDATE T1 SET f2 = 'CHANGED' WHERE f1 = 1;");
47 System
.out
.println("update exception---" + e
.getMessage());
52 Connection con1
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
53 Statement cStmt1
= con1
.createStatement();
54 cStmt1
.execute("DROP TABLE T1 ;");
58 System
.out
.println("Exception in Test: " + e
.getMessage());