2 //Create a table and index for that table. Then do (INSERT/UPDATE/DELETE/SELECT) with no params statement.
9 public static void main(String
[] args
)
13 Class
.forName("csql.jdbc.JdbcSqlDriver");
14 Connection con
= DriverManager
.getConnection("jdbc:gateway", "root", "manager");
15 Statement cStmt
= con
.createStatement();
18 cStmt
.execute("INSERT INTO t1 VALUES (1, 'FIRST');");
19 cStmt
.executeUpdate("INSERT INTO t1 VALUES (2, 'SECOND');");
23 rs
= cStmt
.executeQuery("SELECT * from t1 where f1 = 1;");
26 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
31 cStmt
.execute("SELECT * from t1 where f1 = 2;");
32 rs
= cStmt
.getResultSet();
35 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
40 cStmt
.executeUpdate("UPDATE t1 SET f2 = 'CHANGED' WHERE f1 = 1;");
45 cStmt
.executeUpdate("DELETE FROM t1 WHERE f1 = 2;");
48 System
.out
.println("After delete, listing tuples:");
49 rs
= cStmt
.executeQuery("SELECT * from t1 ;");
52 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
57 System
.out
.println("Exception in Test: "+e
);