2 //Open a connection and then close it. After that execute INSERT/QUERY/UPDATE statement. It should fail
10 public static void main(String
[] args
)
14 Class
.forName("csql.jdbc.JdbcSqlDriver");
15 Connection con
= DriverManager
.getConnection("jdbc:gateway://localhost:5678", "root", "manager");
16 Statement cStmt
= con
.createStatement();
20 //after close the connection,execute "INSERT" statement,it should fail
23 cStmt
.execute("INSERT INTO t1 VALUES (1, 'FIRST');");
28 System
.out
.println("insert exception---" + e
.getMessage());
31 //after close the connection,execute "QUERY" statement,it should fail
34 cStmt
.executeQuery("SELECT * from t1 where f1 = 1;");
39 System
.out
.println("query exception---" + e
.getMessage());
42 //after close the connection,execute "UPDATE" statement,it should fail
45 cStmt
.executeUpdate("UPDATE t1 SET f2 = 'CHANGED' WHERE f1 = 1;");
50 System
.out
.println("update exception---" + e
.getMessage());
56 System
.out
.println("Exception in Test: " + e
.getMessage());