Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help Q4 [15 points] Database. 1. Using NetBeans, create a new database and call it DbFinal, and give it the username userfinal, and the password
Help
Q4 [15 points] Database. 1. Using NetBeans, create a new database and call it DbFinal, and give it the username "userfinal", and the password "dbpassfinal. 2. Implement a Java class called StudentDataBase, which has the following three methods: 1- public void create Table(). This method connects to the database DbFinal, and creates a new table called Student in Db Final. The table contains the fields: i. Id, Integer, not null, primary key. ii. StName, VARCHAR(255) iii. GPA, Integer iv. Major, VARCHAR(255) I 2- public void insertData(). This method connects to the database DbFinal, and inserts the following records into the Student table: anu misers the TUNTUwing Telurus TITLULITE Suuenil tavie. 112, Ali, 92, Computer Science 214, Malak, 78, Software Engineering 628, Enas, 84, Physics 3- public void getData(). This method connects to the database Db Final and retrieves each student record that has the GPA greater than 80 (i.e., GPA>80). Then, the method prints (using System.out.println) the id and name fields of each retrieved record. Important note: Inside each of the above three methods, you must write all the necessary code to connect to the database, create and execute statements, and close the connection. You must also write the necessary try-catch blocks. In the catch blocks, call the printStackTrace() method. 4- Main method. This method creates and instantiates and object of type StudentDataBase, then calls the methods createTable(), insertData(), and getData(). TStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started