1 //Test 5000 connections
7 public static void main(String
[] args
)
11 Class
.forName("csql.jdbc.JdbcSqlDriver");
12 Connection con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
13 Statement cStmt
= con
.createStatement();
15 cStmt
.execute("CREATE TABLE T1 (f1 integer, f2 char (20));");
18 PreparedStatement stmt
= null;
19 for (int i
=0; i
<5000 ; i
++)
21 con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
22 con
.setAutoCommit(false);
23 stmt
= con
.prepareStatement("INSERT INTO T1 VALUES (?, ?);");
25 stmt
.setString(2, String
.valueOf(i
+100));
26 ret
= stmt
.executeUpdate();
32 if (i
%100 ==0) {System
.out
.println("Total Connections made "+ i
); System
.gc(); Thread
.sleep(500);}
34 System
.out
.println("Total Rows inserted "+ count
);
37 con
= DriverManager
.getConnection("jdbc:csql", "root", "manager");
38 cStmt
= con
.createStatement();
39 System
.out
.println("Listing tuples:");
40 ResultSet rs
= cStmt
.executeQuery("SELECT * from T1;");
48 System
.out
.println("Total rows selected " + count
);
49 cStmt
.execute("DROP TABLE T1;");
51 if (count
!=5000) System
.exit(1); else System
.exit(0);
53 System
.out
.println("Exception in Test: "+e
);