graph generation using jfreechart and retrieving values from the database
I have made a database containing 4 subject marks and name and roll no. of students.The dsn name is chartdsn. I want to retrieve the data from the access database using prepared statement and then display the bar graph using jfreechart API .This whole retrieval and display of chart is to be done in a servlet..
Note that it is a access made database.
How can I proceed ..Pls answer.Its very urgent.
I got this answer but i need to know the meaning of this line
JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:odbc:student",
"sun.jdbc.odbc.JdbcOdbcDriver","root","root");
what is student here and how the data is being retrieved.
The answer given is below..
Answer:
Follow these steps:
1)Go to the start->Control Panel->Administrative Tools-> data sources.
2)Click Add button and select the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click finish button.
4)Then give Data Source Name and click ok button.
er
5)Your DSN will get created.
6) Restart your tomcat server and run your jsp code.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="org.jfree.chart.ChartFactory" %>
<%@ page import="org.jfree.chart.ChartUtilities" %>
<%@ page import="org.jfree.chart.JFreeChart" %>
<%@ page import="org.jfree.chart.plot.PlotOrientation"%>
<%@ page import="org.jfree.data.*" %>
<%@ page import="org.jfree.data.jdbc.JDBCCategoryDataset"%>
<%
String query="SELECT * from chart";
JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:odbc:student",
"sun.jdbc.odbc.JdbcOdbcDriver","root","root");
dataset.executeQuery(query);
JFreeChart chart = ChartFactory .createBarChart3D(
"Test",
"Id",
"Score",
dataset,
PlotOrientation.VERTICAL,true, true, false);
try
{
ChartUtilities.saveChartAsJPEG(new File("C:/chart.jpg"), chart, 400, 300);
}
catch (IOException e){
System.out.println("Problem in creating chart.");
}
%>
please reply its very urgent..how to do it.
View Answers
November 9, 2011 at 11:40 AM
student is our dsn name and as far as JDBCCategoryDataset is being concern, it is a class provided by JFreechart. This class provides the implementation over a database JDBC result set. Its constructor consists of url, driver, user, pass to connect to the database. The dataset is populated via a call to executeQuery(String) with the string SQL query.
Related Tutorials/Questions & Answers:
Create Line Graph using database valuesCreate Line
Graph using database values
JFreeChart library has made... retrieved
from the
database. In this section, you will learn how to create a x-y line
graph by
retrieving the
values from the
database.
Here is the code:
import
Advertisements
Line Graph using JFreeChartLine
Graph using JFreeChart I need to draw a line
graph of the (no. of sales made on y axis) by a shop with (dates on x axis)
using data
from MySQL
database and
JFreeChart Line Graph using JFreeChartLine
Graph using JFreeChart I need to draw a line
graph of the (no. of sales made on y axis) by a shop with (dates on x axis)
using data
from MySQL
database and
JFreeChart.
DRIVER: com.mysql.jdbc.Driver
URL:
jdbc:mysql
Line Graph using JFreeChartLine
Graph using JFreeChart I need to draw a line
graph of the (no. of sales made on y axis) by a shop with (dates on x axis)
using data
from MySQL
database and
JFreeChart.
DRIVER: com.mysql.jdbc.Driver
URL:
jdbc:mysql
Retrieve values from database using viewsRetrieve
values from database using views hi.........
I have a huge
database so i have created views in
database where i am selecting only...
from that created views and display on form . I am trying to do so but its
retrieving from oracle database using jsp combo boxretrieving from oracle
database using jsp combo box hi this is my... name of the server has to display in the process name field
from the oracle
database please help on this i need code
using servlets please help me .
<
graph generation from xml design filegraph generation from xml design file how to search words in XML file with javascript. i have copied contents of XML file into word file.
using searched keywords i would like to draw
graph retrieving xml document from databaseretrieving xml document
from database Hi Guys,
I want to retrieve the xml document stored in the
database on to a jsp page
using jdbc/odbc connnection.Please help me in implementing this feature.
Thank You
Madhu
Create Pie Chart using database valuesCreate Pie Chart
using database values
Java provides
JFreeChart library which... a pie chart by
retrieving the
values from the
database.
Here is the code... void main(String[] args) throws Exception {
String query = "SELECT *
from how to display values from database into table using jsphow to display
values from database into table
using jsp I want to display
values from database into table based on condition in query, how... the
values from database based on the bookname or authorname entered must be display
retrieving info from DB using struts?retrieving info
from DB
using struts? Hi. I was looking info about
retrieving info
from a
database using struts.
I need a .java that I suppose connects to a
database and show the info on a jsp.
Somebody could help me
jfreechart display from access database data.jfreechart display
from access
database data. I have made a
database... to retrieve the data
from the access
database using prepared statement and then display the bar
graph using jfreechart API .This whole retrieval and display of chart
Retrieving the Image from a database TableRetrieving the Image
from a
database Table
Consider a case where we want... to retrieve the
image
from the
database table. You can do it very easily after...
from the
database table our java program need to make a connection
check radio button on retrieving the value from database.check radio button on
retrieving the value
from database. HI
i am new to jsp.In my applcation i having a problem. I am
retrieving
user payment
from... information
from database the i want to show
cash radio button checked.How can i do
Retrieving Data from Database to fill Combo BoxRetrieving Data
from Database to fill Combo Box Sir,
I have a JSP Page with a combo box and a label. I have a
database that has two fields id... displaying path that is stored in the
database but not the image itself. Kindly
jfreechart displaying chart from access databasejfreechart displaying chart
from access database I have these 2 codes.
array.java----in which i retrieve the
values from the
database .
import... javax.servlet.http.HttpServletResponse;
/**
*
* @author AARUSHI
*/
class
database
{
int roll;
String
Create Bar Chart with database valuesCreate Bar Chart with
database values
In this section, you will learn how to create a bar chart by
retrieving the
values from the
database. For this purpose...
from MySQL
database and then
using
the jfree chart library to create chart
edit values of database using jspedit
values of
database using jsp hi i want a code to edit the row
from tye
database and display in a page which containd radio buttons and drop down boxes
using jsp code
edit values of database using jspedit
values of
database using jsp hi i want a code to edit the row
from tye
database and display in a page which containd radio buttons and drop down boxes
using jsp code
get values from Excel to databaseget
values from Excel to database hi i want to insert
values from Excel file into database.Whatever field and contents are there in excel file that should go to
database which exists. am
using SQL Server management studio
Retrieving value from multiple table in databaseRetrieving value
from multiple table in database Hi fnds, I want to maintain the financial
database of 20 users for 1 year and update the details...
FROM (
SELECT *
FROM month1
UNION ALL
SELECT *
FROM month2
UNION ALL
make chart or graph from database - Java Beginnersmake chart or
graph from database d,
I want to ask about how to make a chart or
graph.
First i have Table name= "customer" and field =(cust_id... customer come to me. in this chart have two
values nm_id and date. Please give
problem in setting the values from database the
values from database.
here is the code:
private JTextField getJTextField1...problem in setting the
values from database hello friends,
can...");
PreparedStatement pst=con.prepareStatement("select *
from form1 where TerminalID
Retrieving JTree structure from database Retrieving JTree structure
from database
This example shows how to
retrieving data
from... the data
from the
database.
Here is the full code for "JTreeStructure.java
insert values from excel file into database the following link:
Insert
values from excel file to
database...insert
values from excel file into database hi i want to insert
values from Excel file into database.Whatever field and contents are there in excel
Retrieving data from data base using jsp combo boxRetrieving data
from data base
using jsp combo box Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one... of the server it has to display the process name
from database into the process name
how to check dates while retrieving data from databasehow to check dates while
retrieving data
from database i want to update
database record based on delivery date i have tried this query but it wont work
b="update deliveryorder set prtnm='"+arr[1]+"',stn='"+arr[0]+"',sbston
getting values from database - JSP-Servletgetting
values from database I tried the following code
abc.html
aaa.jsp
I am not getting exceptions now... JSP code separately.If it will not display
database values then try your code