LAB ACTIVITY 4F
Manipulates JDBC connectivity (JTable).
Manipulates JDBC connectivity (JTable).
Learning Outcomes
By the end of this lab, students should be able to :
Understand how to connect to a database using JDBC.
Write a Java program using JDBC.
Hardware/ Software : Personal Computer, Java Development Kit version X.x.x., NetBeans IDE 12.0
Activity Outcome: Student know how to use JDBC
You first need to create a database in MySQL and a table to store book records. Use the following SQL commands:
Now let's create the GUI using Java Swing. This will be the interface where you can enter book details and display them in a table.
Here's the Java code for the GUI:
In this step, we will add an event listener to the Insert button so that, when clicked, it will retrieve data from the text fields and insert it into the MySQL database.