There are a few ways to do this, one is to use the JDBC adapter from DataFX.
Update
FXML itself just defines an xml based UI structure, it cannot load data from a database.
When the data originates from the database, creating a static fxml file containing the data values is likely a bad idea in most cases. Anytime the data in the database changes, you will need to generate and load a new fxml file and for that you will need to either create the new file by hand or write a fragile program to generate the new fxml file based upon the data in the database.
Suggested approach:
- Use the fxml only to define your TableView structure but not to contain actual data values.
- In your JavaFX Java code connect to the mysql database.
- Use the DataFX JDBC data source adapter to retrieve the data from the database and populate your TableView.
You could write your own code to do step 3. Using your own code might be a good idea if you wish to use JPA (which I think DataFX does not currently directly support). Otherwise you will probably end up with better results quicker using the DataFX implementation.
To find out how to do edits in TableView, read this TableView tutorial. Again, DataFX will help you by providing Control Cell Factories for edits - so I'd recommend using DataFX for this rather than handcoding the TableView edit handling.
I'm not sure if the DataFX code will help you when you need to commit edits to a database; in that case you will probably need to add your own JDBC or JPA code to commit the changes.