Question: For this assignment, you will need to connect to a MySQL database from Eclipse with Java using the same JDBC device driver.You can use the
For this assignment, you will need to connect to a MySQL database from Eclipse with Java using the same JDBC device driver.You can use the same MKYONG website, but be sure to use the connect string for MySQL instead of Oracle.
1. Using the same emp database from assignment #9, you will need to create a new table with a primary key. Thus the new table should be stored as an embedded SQL statement in a .java file that creates the new table and primary key on employeeID. For example, the table should look like the following: PAYROLL (payrollID integer PRIMARY KEY, week integer, day integer, year integer, EmployeePayment Double(10,2), employeeID integer FOREIGN KEY). 2. In addition, this table should have a foreign key into your employee table between the employeeID columns. Thus, you need to create a second .java with embedded SQL file that creates the foreign key between the two tables. 3. The new table needs to insert data into the new payroll table. So, you need to add a 3 rd .java file with embedded SQL. This file needs to add 1 or more rows to payroll for each of the columns listed above. Make sure the employee 4. Finally, the new table should be dropped from the database. Thus, you need to add a 4 th .java file to drop the table from the database. Note that you will need to alter the table and drop the foreign key before dropping the table. Otherwise, the database will give you an error.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
