Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA CODE (Please work this exercise in database Access) Chapter 20 - Exercise 1 - Creating table and inserting records 3-18 20-1. Write a program

JAVA CODE (Please work this exercise in database Access)

Chapter 20 - Exercise 1 - Creating table and inserting records 3-18

20-1. Write a program that will create a yankees table for a baseball part a Access database file or a part b Derby database file. It will have fields for the name of the player, the position of the player, and the player's number. Then insert the following records into the table (a list of yankees from a few years ago). Use SQL commands for the create and insert. Then use a ResultSet to list all records and all fields. If you use Access, set up UCanAccess or the ODBC JDBC bridge and create an Access baseball database file, then the lab exercise will create the yankees table. If you use Derby, set up the derby.jar file, set up the extra files, and run with the proper arguments. Bernie Williams CF 51 Derek Jeter SS 2 Mariano Rivera P 42 Jason Giambi 1B 25 Mike Mussina P 35 Alfonso Soriano 2B 12 You then realize Giambi would be better as a DH instead of 1B, so use an SQL command to update the table for the record with Jason Giambi as the Name in the java program. For derby, the two new key lines in the try block are: SimpleDataSource.init("databaseyankees.properties"); /* database configuration management in databaseyankees.properties separate file */ con = SimpleDataSource.getConnection(); /* Connection object created from Properties object in SimpleDataSource.java file */

Attach your .java program either using 1 - Access OR 2 - Derby. Include an output text file to show the displaying of all records and all fields to show the proper results and database table were created and connected to.

Chapter 20 - Exercise 2 - Queries 4-1

20-2. Create 2 queries for the yankees table from 20-1 from the baseball Access database or Derby database. It will be set up similar to 20-1, then add the query and ResultSet. List the results from the ResultSet on the screen. You can combine both into one java program. You can use either 1 - Access or 2 - Derby. Give the proper query statement and display the results. a. The first will be to list the players name, number, and position (in that order) for all players whose number is less than 20 (of course most of the low numbers have been retired because of all the great players in the history of the Yankees). Sort the list by position. b. The second will be to ask the user what position they want to see listed, then list the name and number for all players at that position.

Attach your .java program either using 1 - Access or 2 - Derby. Include an output text file to show the connection and database table were connected to and queried. For position, pick P. For the outupt file, you can run the program in the console, then copy the results in the console.

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_2

Step: 3

blur-text-image_3

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

14 Reliability and validity of selection tests/tools/ methods.

Answered: 1 week ago