} } } stmt.close(); // All done. Close the statement object. } catch( Exception e ) { e.printStackTrace(); System.out.println(e.getMessage()); } return column; // Finally, return the entire column[] array. } Showing The Results Now that we have the data nicely packaged into our Java object, how do we show it? The code in Listing 7.2 dumps the data in the object to the screen. We simply loop through the array and print the data. Listing 7.2 Code to print retrieved data to the console. public void ShowFormattedData(String[] columnD ) { int i; for ( i=0; i< columnD.length; i++) { System.out.println(columnD[i]+"n"); } } Charting Your Data Now that we ve covered the preliminaries, we are ready to get to the fun stuff! Instead of creating a package that has graphics utilities, we re going to use the NetCharts library, which is stored on the accompanying CD-ROM. The package on the CD is only an evaluation copy. Stop by http://www.netcharts.com to pick up the latest version (and some helpful documentation). We ll use the table in Table 7.1 and a bar chart to display the salary information for our fictional company. Figure 7.1 shows the applet that is generated from the code in Listing 7.3. Remember, the code for this example can be found on the accompanying CD-ROM, or at The Coriolis Group Web site at http://www.coriolis.com/jdbc-book. Figure 7.1 The bar chart applet. Listing 7.3 Dynamically generating a bar chart from a database query Part I. /*
We know it is important decision to make, effects your wallet, and the quality of your web site, so relax and visit shared web hosting.