且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试通过JSP/Servles使用JFreeChart; JDBCCategoryDataset和CategoryDataset的问题

更新时间:2023-02-06 16:27:15

因为

Because JDBCCategoryDataset implements the CategoryDataset interface, no cast should be required in the assignment: CategoryDataset data = readData(); I get the following chart from the variation of readData() outlined below. I suspect that you have another problem.

private CategoryDataset readData() { 

    JDBCCategoryDataset data = null; 
    Connection con; 
     try { 
        con = DriverManager.getConnection("jdbc:h2:mem:test", "", ""); 
        data = new JDBCCategoryDataset(con); 
        String sql = "select TYPE_NAME, PRECISION "
            + "from INFORMATION_SCHEMA.TYPE_INFO "
            + "where PRECISION BETWEEN 1 AND 12"; 
        data.executeQuery(sql); 
        con.close(); 
    } 
    … 
    return data; 
 }