Hello Today I’m going to demonstrate the PieChart of Javafx 2.0 beta release. This PieChart does  gets it’s data from the database. I’ll be using mysql as the database for instance.

The requirement for this demonstration:

Database Structure:
The database structure of the demostration is given below:

Mysql JDBC Connectivity
Let’s start first JDBC in Javafx. We don’t need to worry of Database connectivity in Javafx , after all javafx is now apart of Java. You must have good knowledge of SQL for this demonstration too.Please add mysql connection in the library. The JDBC connectivity for mysql can be done from the below code.

* I’ve connected the database as ‘company’ with username ‘root’ and password ‘root’

JDBC inside JavaFX 2.0

Now Let’s implement our JDBC inside JavaFX 2.0. We are going to first connect our database and grab the data for our piechart.

Now here we go the compiled version output:

PieChart Demo with JDBC