Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]
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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

Explain the role of research design in HRD evaluation

Answered: 1 week ago