Complete the Java program to create a Horse table, insert one row, and display the row....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Complete the Java program to create a Horse table, insert one row, and display the row. The main program calls four methods: 1. createConnection () creates a connection to the database. 2. createTable() creates the Horse table. 3. insertHorse () inserts one row into Horse. 4. selectAllHorses () outputs all Horse rows. Complete all four methods. Method parameters are described in the template. Do not modify the main program. The Horse table should have five columns, with the following names, data types, constraints, and values: Name Data type integer The program output should be: Id Name Breed text text double Height BirthDate text Constraints primary key, not null 1 Value 'Babe' 'Quarter horse' 15.3 '2015-02-10' The program output should be: All horses: (1, 'Babe', 'Quarter Horse', 15.3, ¹2015-02-10¹) This lab uses the SQLite database rather than MySQL. Both SQLite and MySQL Connector/J implement the JDBC API. Consequently, the API is as described in the text, with a few exceptions: • Use the connection string "jdbc:sqlite:in-memory to connect to an in-memory database. • Use the text data type instead of char and varchar. SQLite reference information can be found at SQLite Java Tutorial, but is not necessary to complete this lab. 500194 1690278.qx3zqy7 LAB ACTIVITY 5.9.1: LAB - Database programming with Java (SQLite) LabProgram.java 4/10 Load default template... Latest submission - 11:23 AM EDT on 08/01/23 Only show failing tests 1:Unit test Test createConnection () returns valid connection Your test produced no output. 2:Unit test Test create Table() creates Horse table Test feedback Horse table does not exist 3:Unit test Test insertHorse() inserts row into Horse table Your test produced no output. Total score: 4 / 10 Download this submission 1/1 0/3 3/3 Test insertHorse() inserts row into Horse table Your test produced no output. 4:Compare output Output is nearly correct, but whitespace differs. See highlights below. Special character legend Your output Expected output All horses: (1, 'Babe', 'Quarter Horse', 15.3, '2015-02-10') < All horses: (1, 'Babe', Quarter Horse', 15.3, '2015-02-10') 0/3 Complete the Java program to create a Horse table, insert one row, and display the row. The main program calls four methods: 1. createConnection () creates a connection to the database. 2. createTable() creates the Horse table. 3. insertHorse () inserts one row into Horse. 4. selectAllHorses () outputs all Horse rows. Complete all four methods. Method parameters are described in the template. Do not modify the main program. The Horse table should have five columns, with the following names, data types, constraints, and values: Name Data type integer The program output should be: Id Name Breed text text double Height BirthDate text Constraints primary key, not null 1 Value 'Babe' 'Quarter horse' 15.3 '2015-02-10' The program output should be: All horses: (1, 'Babe', 'Quarter Horse', 15.3, ¹2015-02-10¹) This lab uses the SQLite database rather than MySQL. Both SQLite and MySQL Connector/J implement the JDBC API. Consequently, the API is as described in the text, with a few exceptions: • Use the connection string "jdbc:sqlite:in-memory to connect to an in-memory database. • Use the text data type instead of char and varchar. SQLite reference information can be found at SQLite Java Tutorial, but is not necessary to complete this lab. 500194 1690278.qx3zqy7 LAB ACTIVITY 5.9.1: LAB - Database programming with Java (SQLite) LabProgram.java 4/10 Load default template... Latest submission - 11:23 AM EDT on 08/01/23 Only show failing tests 1:Unit test Test createConnection () returns valid connection Your test produced no output. 2:Unit test Test create Table() creates Horse table Test feedback Horse table does not exist 3:Unit test Test insertHorse() inserts row into Horse table Your test produced no output. Total score: 4 / 10 Download this submission 1/1 0/3 3/3 Test insertHorse() inserts row into Horse table Your test produced no output. 4:Compare output Output is nearly correct, but whitespace differs. See highlights below. Special character legend Your output Expected output All horses: (1, 'Babe', 'Quarter Horse', 15.3, '2015-02-10') < All horses: (1, 'Babe', Quarter Horse', 15.3, '2015-02-10') 0/3
Expert Answer:
Answer rating: 100% (QA)
Answer 1 Create a connection to a sqlite inmemory database Create a connection to a sqlite inmemory database Returns Connection object public static Connection createConnection YOUR COOE HERE Use conv... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Show in a drawing similar to Figure 18.18 how two different programs with the same logical address space can be transformed by virtual storage into independent parts of physical memory. Figure 18.18?...
-
What test can be used to test the hypothesis that the mean degree of itching is the same for active vs. placebo eyes? Table 7.10 Itching scores reported by participants a Itching score left eye...
-
In this programming assignment you will practice using ArrayLists, Inheritance and Polymorphism. You are to write a game called Magical Creatures War. You will do this by implementing a class called...
-
For the charge configuration of Prob. 2.15, find the potential at the center, using infinity as your reference point.
-
In plants, terpenes are biosynthesized by a pathway that involves loss of CO2 from 3-phosphornevalonate 5-diphosphate to yield isopentenyl diphosphate. Use curved arrows to show the mechanism of this...
-
Draw and name the four stereoisomers of 1,3-dichloro-2-butanol using: a. Perspective formulas b. Fischer projections
-
(a) Show that Eqs. 8.47 reduce to Eqs. 8.46 when you consider a system of just one object. (b) Follow the procedure used to get from Eq. 8.21 to Eq. 8.24 for a system of many interacting objects....
-
Forte Inc. produces and sells theater set designs and costumes. The company began operations on January 1, 2016. The following transactions relate to securities acquired by Forte Inc., which has a...
-
You are planning a 30-day vacation in Malaysia in one year's time. The present charge for a luxury suite plus meals is RM760.00 per day and the RM is presently trading at RM 3.8000/$. Hence the $...
-
Cinder Inc. is a Canadian-controlled private corporation based in your province. The company operates a wholesale business. The following information is provided for its year ended May 31, 2020: 1....
-
Q3 (15p) A schematic of thermal boundary layer development on an isothermal flat plate with a constant free stream flow velocity (u) is shown below. The plate is made of pure iron and the flow is...
-
We determined that the actual number of visits in the selection sort algorithm is: T(n) = 1n + 3n-3 We characterized this method as having O(n) growth. Compute the actual ratios T(2,000)/T(1,000)...
-
Produce an infinite stream that contains the factorials 1!, 2!, 3!, and so on. Hint: First produce a stream containing arrays [1, 1!], [2, 2!], [3, 3!], and so on. Use BigInteger values for the...
-
Reimplement Exercise E14.11 so that you dont generate new arrays with the subsequences, but instead collect the starting index values. Then implement the generalized merge method so that it receives...
-
Prove that a heap of height h contains at least 2 h1 elements but less than 2 h ele ments.
-
Write a method: public static String toString (Stream stream, int n) list of its first n elements. that turns a Stream into a comma-separated
-
Which of the following statements best describes an oxidation-reduction reaction? OOOO If there is a change in the oxidation states of atoms from reactants to products, the reaction is an oxidation-...
-
Consider the function f and its graph. a. Estimate the zeros of the area function b. Estimate the points (if any) at which A has a local maximum or minimum. c. Sketch a graph of A, for 0 x 10,...
-
Verify Lemma 1.9 for 2 2 matrices by direct calculation.
-
What are the possible minimal polynomials if a matrix has the given characteristic polynomial? (a) (x - 3)4 (b) (x + 1)3(x - 4) (c) (x - 2)2(x - 5)2 (d) (x + 3)2(x - 1)(x - 2)2 What is the degree of...
-
To use Definition 2.7 to check whether a subspace is t invariant, we seemingly have to check all of the infinitely many vectors in a (nontrivial) subspace to see if they satisfy the condition. Prove...
-
A \(15.0-\mathrm{kg}\) block measures \(0.750 \mathrm{~m}\) top to bottom, and each horizontal face has an area of \(0.0125 \mathrm{~m}^{2}\). The block hangs, with its long central axis vertical,...
-
A hydrogen-filled balloon is used to lift a \(125-\mathrm{kg}\) stone off the ground. The basket holding the stone has a mass of \(15.0 \mathrm{~kg}\). What must the minimum radius \(R\) of the...
-
Initially, both legs of a mercury manometer are open to the atmosphere, and the mercury height in the left leg is \(40.0 \mathrm{~mm}\). You inflate a balloon until it has a surface area of \(0.300...
Study smarter with the SolutionInn App