aspose file tools*
The moose likes JavaFX and the fly likes How to populate a TableView with data fetched from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "How to populate a TableView with data fetched from database" Watch "How to populate a TableView with data fetched from database" New topic
Author

How to populate a TableView with data fetched from database

Oliver Much
Greenhorn

Joined: Aug 06, 2013
Posts: 1
I have a TableView that was created in JavaFx SceneBuilder. Does anyone know how to go about populating it with data from a database? I've looked around but the sample code I get are only come in fragments which I can't really get my head around. I'm a newbie at programming in JavaFx and was hoping to find some sample code that does this at some basic beginner's level, for study.

Would really appreciate some help here. Thank you all in advance.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1083
    
  10

Hi Oliver,
Welcome to the Ranch!

I would like to point you to the tutorial page which explains working with TableView. Once you get going with this, you should be able to fetch data from the database and populate the table.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 144
    
    9
Review this sample code for populating a ListView from a H2 database.

Try to get it running.

Once you have it running and understand it, try to adapt it to use a TableView (based on information provided in the tutorial Ranganathan linked).

If you are a newbie to JavaFX, try something different from accessing a database via a TableView - e.g. just use the JavaFX library without database integration and learn how to use the scene graph by creating something like a really drawing app.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to populate a TableView with data fetched from database