Connecting NetBeans with MySQL
Click on the Services tab in the NetBeans IDE, and navigate to Databases | Drivers. You will see that NetBeans comes with several different database drivers:
Right-click on the Databases node, and click on Register MySQL Server…as shown in the following screenshot:
For Windows users, this will open a dialog box with default settings. Enter the admin password used when installing MySQL server in the previous chapter, and check the Remember Password option:
Mac users will see a different window prior to setting the connection properties. Select the MySQL driver before clicking on the Next button:
This will then allow you to specify the required database connection details:
When finished with these tasks, you will see MySQL Server listed in the Databases node. Right-click on the server, and select Connect to connect to the server (if not already connected):
This will connect NetBeans to MySQL server and list the available databases. Right-click on the server, and select Create Database as shown in the following screenshot:
Enter the database name as shown in the following screenshot, and click on OK to create the database:
The final step is to connect to the newly created task_time_tracker database. Right-click on task_time_tracker and select Connect… as shown in the following screenshot:
This will add a MySQL database connection entry for the task_time_tracker database, which can be opened by right-clicking on it whenever required:
Now you can right-click on the database connection and select the Execute Command… option to open the SQL Command editor in the workspace:
The SQL Command editor is where you will type and execute commands against the database: