title: bar chart in d3 using mysql database
body: <p>I have created a table  by taking two columns from mysql database and converting it json object it was sucessfully working fine but i m not 
  getting any idea how i can plot a bar chart using those two column.it will be great helpful if some one can guide me ..
  Here is my code:</p>
  
  <pre><code>&lt;%@ page language="java" import="java.sql.*"%&gt;
  &lt;%@ page language="java" import="org.json.JSONObject"%&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;Read from mySQL Database&lt;/title&gt;
  &lt;!DOCTYPE html&gt;
  &lt;script src="http://d3js.org/d3.v3.min.js"&gt;&lt;/script&gt;
  &lt;meta charset="utf-8"&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div align="center" width="85%"&gt;
  &lt;center&gt;
  &lt;table border="1" borderColor="#ffe9bf" cellPadding="0" cellSpacing="0" width="658" height="63"&gt;
  &lt;tbody&gt;
  &lt;%
  String DRIVER = "org.gjt.mm.mysql.Driver";
  Class.forName(DRIVER).newInstance();
  
  
  Connection con=null;
  ResultSet rst=null;
  Statement stmt=null;
  
  try{
  String url="jdbc:mysql://localhost/sales?user=root&amp;password=root";
  
  int i=1;
  con=DriverManager.getConnection(url);
  stmt=con.createStatement();
  rst=stmt.executeQuery("select * from product limit 10");
  JSONObject jsonObject = new JSONObject();
  
  while(rst.next()){
  jsonObject.put("sku"+i,rst.getString(2));
  
  %&gt;
  &lt;tr&gt;
  
  &lt;td bgColor="#ffff98" vAlign="top" width="107" height="19"&gt;&lt;%=rst.getString(2)%&gt;&lt;/td&gt;
  &lt;td bgColor="#ffff98" vAlign="top" width="270" height="19"&gt;&lt;%=rst.getString(4)%&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;%
  
  
  i++;
  }
  String outputString = jsonObject.toString();
  rst.close();
  stmt.close();
  con.close();
  }catch(Exception e){
  System.out.println(e.getMessage());
  }
  
  %&gt;
  
  &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/center&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>