This is just a quick and simple example of pulling live data using JDBC from the Contract database. It joins several tables to report the number of closed contracts by type. The number of contracts in each type relates to the height vs. what percentage of the total those contracts make up. The more contracts there are to work with, the better this graph looks. Because of the way we make the graph, 1% is the smallest any wedge can be. Therefore it is possible to get empty wedge shapes if the numbers don't work out just right due to rounding errors.
This is the mySQL query used:
SELECT business_unit_type, count(1) AS numberOfContracts, business_unit_id
FROM Contract_Table, Client_Table, Status_Table, Business_Unit_Table
WHERE contract_client_id = client_id
AND contract_status_id = status_id
AND contract_business_unit_id = business_unit_id
AND contract_status_id >= 6 AND contract_status_id <= 10
GROUP BY business_unit_id
ORDER BY business_unit_type;