2 //donot run csql server
3 //Create a table and index for that table. Then do (INSERT/UPDATE/DELETE/SELECT) with no params statement.
9 public class GwTest11
{
10 public static void main(String
[] args
)
14 Class
.forName("csql.jdbc.JdbcSqlDriver");
15 Connection con
= DriverManager
.getConnection("jdbc:gateway", "root", "manager");
16 Statement cStmt
= con
.createStatement();
19 cStmt
.execute("INSERT INTO t1 VALUES (1, 'FIRST');");
20 cStmt
.executeUpdate("INSERT INTO t1 VALUES (2, 'SECOND');");
24 rs
= cStmt
.executeQuery("SELECT * from t1 where f1 = 1;");
27 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
32 cStmt
.execute("SELECT * from t1 where f1 = 2;");
33 rs
= cStmt
.getResultSet();
36 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
41 cStmt
.executeUpdate("UPDATE t1 SET f2 = 'CHANGED' WHERE f1 = 1;");
46 cStmt
.executeUpdate("DELETE FROM t1 WHERE f1 = 2;");
49 System
.out
.println("After delete, listing tuples:");
50 rs
= cStmt
.executeQuery("SELECT * from t1 ;");
53 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
58 System
.out
.println("Exception in Test: "+e
);