Multiple queries to generate reports on mysql data

Hi all!

I am looking for some advice.

I plan to generate pdf reports on the following:

1.Gender count of total applicant pool = M/F.

2. How many are freshmen, sophomore, etc...

3. How many applications are complete

4. total number of applicants for the year. This will be plotted on an x-y graph for each year.

Should I store these individual values in a table like or pull the data from the db on the fly?

Im using itext with jfree. Here's a sample

public static void convertToPdf(JFreeChart chart, int width, int height, String filename) {

// step 1

Document document = new Document(new Rectangle(width, height));

try {

// step 2

PdfWriter writer;

writer = PdfWriter.getInstance(document, new FileOutputStream(filename));

// step 3

document.open();

// step 4

PdfContentByte cb = writer.getDirectContent();

PdfTemplate tp = cb.createTemplate(width, height);

Graphics2D g2d = tp.createGraphics(width, height, new DefaultFontMapper());

Rectangle2D r2d = new Rectangle2D.Double(0, 0, width, height);

chart.draw(g2d, r2d);

g2d.dispose();

cb.addTemplate(tp, 0, 0);

}

catch(DocumentException de) {

de.printStackTrace();

}

catch (FileNotFoundException e) {

e.printStackTrace();

}

// step 5

document.close();

}

/**

* Gets an example barchart.

* @return a barchart

*/

public static JFreeChart getBarChart() {

DefaultCategoryDataset dataset = new DefaultCategoryDataset();

dataset.setValue(40, "hits/hour", "index.html");

dataset.setValue(20, "hits/hour", "download.html");

dataset.setValue(15, "hits/hour", "faq.html");

dataset.setValue(8, "hits/hour", "links.html");

dataset.setValue(31, "hits/hour", "docs.html");

return ChartFactory.createBarChart("Popularity of iText pages",

"Page", "hits/hour", dataset,

PlotOrientation.VERTICAL, false, true, false);

}

[2058 byte] By [iketurnaa] at [2007-11-27 8:10:05]
# 1

Hi,

If the data is being requested very frequently then its better to store them in some place and get it from there when requested. If not better query them when required.

Try to create indexes on the fields for which you want the aggregate values [count of].

Regards,

Rakesh

rakesh_mscita at 2007-7-12 19:53:28 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

hi i have query in applet

MY APPLET IS USING ODBC AND CONNECTING TO ACCES.

I HAVE CREATED POLICY FILE SO THAT I CAN DISPLAY APPLET IN APPLETVIEWER.

APPLET RUNS FINE IS APPLETVIEWER WITH FOLLOWING COMMANDLINE

Appletviewer -jDJava.security.policy = pol label.htm.

however when i try to display applet in web browser, it display

following error message "load-Can't instantiate class"

any help will be welcome

MITZa at 2007-7-12 19:53:28 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

@MITZ:

Christ, stop hijacking and multi-posting this same question all over the place!!!

http://forum.java.sun.com/thread.jspa?threadID=707757

http://forum.java.sun.com/thread.jspa?threadID=5186205

http://forum.java.sun.com/thread.jspa?threadID=5190321

http://forum.java.sun.com/thread.jspa?threadID=5187789

http://forum.java.sun.com/thread.jspa?threadID=5190317

@people who want to answer MITZ:

I suggest doing so in the thread which was posted in the Signed Applets section of this forum:

http://forum.java.sun.com/thread.jspa?threadID=5190324

prometheuzza at 2007-7-12 19:53:28 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...