Step
1 - Construct the Database info file
The database info file contains both the information
necessary to create a connection to the database
and the SQL statements to execute in order to
retrieve the data values.
Database
Connection Info
There
are 4 pieces of info required to make the Database
Connection which are specified by the following
parameters,
Database:
Driver:
User:
Password:
Database: - This is the database connection
path and name.
eg. If you have a MySQL database called Sales
you may have,
Database: jdbc:mysql://localhost/Sales
Driver: This is the location of the JDBC Driver for your database system. In order for the graphing servlet to connect
to your database it is vital that you have the correct JDBC driver set up and configured for you system. For further information
on JDBC database drivers please click here.
User: The username which the graphing
servlet will use to connect to the database
Password: The database password for the
Username specified.
Series SQL Statements
For each series of data an SQL Statement should
be specified. The graph servlet will execute each
statement and take the first data item of each
record returned as the value for that data item.
For instance if you have a table which holds monthly
sales figures for 2 products X and Y then your
statements may look like,
series1:
Select Value from SalesBar where Year=2003 and
Product='X' ORDER BY Month
series2: Select Value from SalesBar where Year=2003
and Product='Y' ORDER BY Month
If 6 records are returned for each record set
this would mean that there are 6 data segments
for each series of data (pie).
For a template Database Info file please click
here.
^^
back to top
|