Question: movieDBDevelop a JDBC program called MovieDB that finds and displays movie records in a database table in different order. The table, called movie, has three

movieDBDevelop a JDBC program called MovieDB that finds and displays movie records in a database
table in different order. The table, called movie, has three columns: name VARCHAR(255),
yr INTEGER, and score INTEGER. The following SQL file creates and populates the table.
-- Create the 'movie' table
CREATE TABLE movie (
name VARCHAR(255),
yr INTEGER,
score INTEGER
;
Insert data into the 'movie' table
INSERT INTO movie (name, yr, score) VALUES
('Oppenheimer',2023,86),
('Barbie',2023,72),
('The Whale', 2022,77),
('Everything Everywhere All At Once', 2022,78),
('Drive My Car', 2021,76),
('No Time to Die', 2021,73);
The program accepts "name" or "score" as input parameters. After that, it prompts the user
for a year. If the input parameter is "name", it should display the details of the matched
records which are sorted by name in ascending order. If the input parameter is "score", it
should display the details of the matched records which are sorted by score in descending
order. If no record matched, the message "Record not found." is displayed. The program
should check the correctness of the input parameter, if the input is incorrect, the usage of this
program is printed.
The program should load the following database. properties file, which stores the driver
name and connection string.
The program should load the following database.properties file, which stores the driver
name and connection string.
jdbc.drivers=org.apache.derby.jdbc.ClientDriver
jdbc.url=jdbc:derby://localhost:1527/MyDB;create=true
Use JDBC to connect to the database. These are sample outputs of running the program
(assuming the above data in the table).
> set CLASSPATH=.;C:\Apache\db-derby-10.16.1.1-bin\lib\derbyclient.jar;%CLASSPATH%
> java a2.MovieDB
Usage: java a2.MovieDB [name|score]
> java a2.MovieDB x
Usage: java a2.MovieDB [name|score]
 movieDBDevelop a JDBC program called MovieDB that finds and displays movie

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!