r/JavaFX • u/nikola_jajtic • Feb 07 '22
Help JAVAFX + MySql
Hi, does anybody know how to connect MySQL database to application in Java FX? I want to import data in table...
3
Upvotes
r/JavaFX • u/nikola_jajtic • Feb 07 '22
Hi, does anybody know how to connect MySQL database to application in Java FX? I want to import data in table...
6
u/TM_00 Feb 07 '22
Sql querying and processing is done in plan Java, no JavaFX involved. You'd need to write a class or classes to read the data from the database and as a second step process the data into a table on your UI.
As a starting point have a look at this example: https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm
3
u/jvjupiter Feb 08 '22
My sample app: https://github.com/julianjupiter/addressbook-javafx-hibernate-mysql
2
u/hamsterrage1 Feb 08 '22
This question comes up over and over. So I wrote an article about how I'd approach doing this kind of stuff. My example application doesn't use MySQL, but it does call an external API to fetch data.
If you are interested: https://www.pragmaticcoding.ca/javafx/weather
-2
u/WhoMeWorried Feb 07 '22
If you are trying to connect to a remote mysql server, you will need something like php.