2 //Irrespective of number set in setFetchSize(), getFetchSize() should return 1
9 public class TestScript10
{
10 public static void main(String
[] args
)
14 Class
.forName("csql.jdbc.JdbcSqlDriver");
15 Connection con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
16 Statement cStmt
= con
.createStatement();
17 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint, f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp);");
19 PreparedStatement stmt
= null, selStmt
= null;
20 stmt
= con
.prepareStatement("INSERT INTO T1 VALUES (?,?,?,?,?,?,?,?,?);");
22 stmt
.setShort(2,(short)2);
23 stmt
.setByte(3,(byte)3);
24 stmt
.setLong(4,(long)4);
25 stmt
.setFloat(5,(float)5);
26 stmt
.setString(6, String
.valueOf(5));
27 stmt
.setDate(7,Date
.valueOf("2008-03-21"));
28 stmt
.setTime(8,Time
.valueOf("18:00:00"));
29 stmt
.setTimestamp(9,Timestamp
.valueOf("2008-03-21 18:00:00"));
34 cStmt
= con
.createStatement();
35 cStmt
.execute("SELECT * from T1;");
36 ResultSet rs
=cStmt
.getResultSet();
37 int retval
=cStmt
.getFetchSize();
38 System
.out
.println("Default Fetch Size "+retval
);
39 cStmt
.setFetchSize(3);
40 retval
=cStmt
.getFetchSize();
41 System
.out
.println("Default Fetch Size "+retval
);
44 System
.out
.println("Tuple value is " + rs
.getInt(1) + " "+
49 rs
.getString(6) + " "+
52 rs
.getTimestamp(9) + " "
58 cStmt
.execute("DROP TABLE T1 ;");
61 System
.out
.println("Exception in Test: "+e
);