Answered step by step
Verified Expert Solution
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
yr INTEGER, and score INTEGER. The following SQL file creates and populates the table.
Create the 'movie' table
CREATE TABLE movie
name VARCHAR
yr INTEGER,
score INTEGER
;
Insert data into the 'movie' table
INSERT INTO movie name yr score VALUES
Oppenheimer
Barbie
The Whale',
Everything Everywhere All At Once',
Drive My Car',
No Time to Die', ;
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.
jdbcdriversorg.apache.derby.jdbcClientDriver
jdbcurljdbc:derby:localhost:MyDB;createtrue
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:Apachedbderbybinlibderbyclientjar;CLASSPATH
java aMovieDB
Usage: java aMovieDB namescore
java aMovieDB x
Usage: java aMovieDB namescore
Step 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