in a (using mysql)table one of my column(i.e. colour) is like :
|Color|
======
|Red |
|Blue |
|Green |
|Red |
|Green |
|Green |
|Red |
With the help of jdbc connection in my current jsp page: I'm trying to show the value in a pie chart(it's wriien in jscript,where I'm putting the value from mysql) like :
Buy I am not able to put values into the graph(I guess there is problem in by code):
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/apps","root","root");
Statement stmt = con.createStatement();
String sql2="select distinct(color) as Color from color_management order by color;";
ResultSet rs2 = stmt.executeQuery(sql2);
String s = rs2.getString(4);
System.out.println(s);
//while(rs2.get)
String sql1 = "select count(case when color='"+s+"' then 1 end) as Color from color_management";
ResultSet rs1 = stmt.executeQuery(sql1);
System.out.println(sql1);
%>
Bookmarks