This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 1076
    
  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: 130
    
    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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to populate a TableView with data fetched from database
 
Similar Threads
JTable in JavaFX
can't run app outside Netbeans - (javafx - ejb - glassfish)
How to populate TableView data on the other screen TextField
Talk about: JavaFX: Developing Rich Internet Applications
Displaying data from Javafx Table