Javafx Database

In this section, I'll be showing you how to connect to a web server database using mysql as the driver. In this tutorial, we are assume the table has been created in the database.

Database: cppjj_name

Table: User

FirstName Age
   


 

1) Get your IP address " White Listed "

     
If your ip address isn't white listed on your host, you would not have access to the database. If you don't know how to do that, you can contact your host admin
        and tell them you want to get your "Internet IP address" white listed, they should be able to help you with that.

        Here is what I did:

                                1) I login to my server host, which is www.hostmonster.com. Once I'm logged in, I go to Remote MySQL then I typed in my "Internet IP address" and add it to my server.

                                        ( Note, each time you are using a different network for Internet, you have to white list the IP address in order for you to have permission to connect to the data base)


2) Download the Driver

     We need to have a driver for us to create a connection to our database. There are different drivers you can download to use, in this tutorial I'm using the MySql Java-Connect 5.1.14. You can download
        the driver here. After you download the driver, unzip it anywhere that you can easily browse it.

 Now, we have everything we need open the NetBeans, create a new Javafx script project.


Here are the things we need to do before we run the above example

        1) Right click on your project, then go to properties

           


            2) Go to libraries, on the right click on  ADD JAR/FOLDER, browse to where you unzip the mysql java connector. Select mysql-connector-java-5.1.14-bin.jar

             3) Make sure you are connect to the Internet, and your IP address is white listed.

                ( Note, some internet changes IP address each time you connect so you would have to white list the IP address again.)

Lets look at a different example, this example will load data from the Database

 

Again, do the steps we did from the example, add the mysql connector-java to the library path, make sure your ip address is white listed.

 

<JavaFX><JavaFX Example><Home>