1 //ExecuteUpdate for SELECT statement it should not return resultset throw exception
3 import java
.sql
.Connection
;
4 import java
.sql
.DriverManager
;
5 import java
.sql
.PreparedStatement
;
6 import java
.sql
.ResultSet
;
7 import java
.sql
.Statement
;
13 public class StmtTest13
15 public static void main(String
[] args
)
19 Class
.forName("csql.jdbc.JdbcSqlDriver");
20 Connection con
= DriverManager
.getConnection("jdbc:csql://localhost:5678/csql", "root", "manager");
21 Statement cStmt
= con
.createStatement();
22 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 char (20));");
23 PreparedStatement stmt
= null, selStmt
= null;
24 stmt
= con
.prepareStatement("INSERT INTO T1 VALUES (?, NULL);");
25 for (int i
=0 ; i
< 10 ; i
++) {
31 selStmt
= con
.prepareStatement("SELECT * from T1 ;");
33 System
.out
.println("yes");
34 int result
= selStmt
.executeUpdate();
39 System.out.print(" NULL");
41 System.out.print(" "+ f1);
42 String f2=rs.getString(2);
44 System.out.println(" NULL");
46 System.out.println(" "+ f2);
50 cStmt
.executeUpdate("Drop table T1;");
53 System
.out
.println("Exception in Test: "+e
);