1 //Test 5000 connections
6 public static void main(String
[] args
)
10 Class
.forName("csql.jdbc.JdbcSqlDriver");
11 Connection con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
12 Statement cStmt
= con
.createStatement();
14 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 char (20));");
17 PreparedStatement stmt
= null;
18 for (int i
=0; i
<5000 ; i
++)
20 con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
21 stmt
= con
.prepareStatement("INSERT INTO T1 VALUES (?, ?);");
23 stmt
.setString(2, String
.valueOf(i
+100));
24 ret
= stmt
.executeUpdate();
30 if (i
%100 ==0) {System
.out
.println("Total Connections made "+ i
); System
.gc(); Thread
.sleep(500);}
32 System
.out
.println("Total Rows inserted "+ count
);
35 con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
36 cStmt
= con
.createStatement();
37 System
.out
.println("Listing tuples:");
38 ResultSet rs
= cStmt
.executeQuery("SELECT * from T1;");
42 System
.out
.println("Tuple value is " + rs
.getInt(1)+ " "+ rs
.getString(2));
47 System
.out
.println("Total rows selected " + count
);
48 cStmt
.execute("DROP TABLE T1;");
51 System
.out
.println("Exception in Test: "+e
);