Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following Courses ERD represents courses and sections as offered at UNB. This ERD applies to Questions 2 to 7 . UNB offers courses in

The following "Courses ERD" represents courses and sections as offered at UNB. This ERD
applies to Questions 2 to 7.
UNB offers courses in a wide variety of subject areas, including the subject area codes CS,
MATH, and ENGL, just to name a few. Those three codes represent the subject areas named
Computer Science, Mathematics, and English, respectively.
Each course in UNB's Undergraduate Calendar is in exactly one subject area and has a course
title (e.g. 'Introduction to Databases').
A section is an offering of a course that takes place during a specific academic term, such as
Winter 2022(represented in this database by the code 'W2022').
7. The following partial text-based JDBC program is used to remove a section from the database.
Fill in the blanks to complete this program.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.util.Scanner;
public class RemoveSection
{
public static void main(String[] args)___________________________________
{ Scanner scan = new Scanner(System.in);
System.out.print("
Enter the id of the section to be removed: ");
int sectionId = scan.nextInt();
Connection connector = DriverManager.getConnection
("jdbc:mysql://cs1103.cs.unb.ca:3306/dbname",
"userid", "PASSWORD");
String deleteText =___________________________________________________
_____________________________________________________________
PreparedStatement deleteStatement =
connector.prepareStatement(deleteText);
deleteStatement.____________________________________________________;
int affectedRows =_________________________________________________;
if (______________________________________________)
System.out.println("
Removal failed
");
else
System.out.println("
Removal succeeded
");
connector.close();
}// end main()
}// end RemoveSection class
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

Students also viewed these Databases questions

Question

=+Creative strategy statement template Example

Answered: 1 week ago

Question

=+6. Why should they buy this product/service?

Answered: 1 week ago