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.
-
Corruption has been a significant problem in Iraq. Opening and running a business in Iraq usually requires paying multiple bribes to government officials. We can think of there being a demand and...
-
Represent the succinic acid molecule,HOOCCH 2 CH 2 COOH through empirical, molecular, structural, and line-angle formulas.
-
Write the following in rectangular form, \(z=a+i b\). a. \(4 e^{i \pi / 6}\). b. \(\sqrt{2} e^{5 i \pi / 4}\). c. \((1-i)^{100}\).
-
A venture capitalist wants to estimate the value of a new venture. The venture is not expected to produce net income or earnings until the end of Year 5 when the net income is estimated at...
-
Jonathan Ltd acquired all the issued shares (ex-div.) of Thomas Ltd on 1 July 2020 for $246 000. At this date the equity of Thomas Ltd consisted of: Share Capital - $130,000 General Reserve - $50...
-
Telstar uses job order costing. The T-accounts below summarize its production activity for the year. 1. Compute the amount for each of the following. a. Direct materials used b. Indirect materials...
-
Investment A : amount required today is $452,952.47. Average rate of return= 2.00% Investment B : Today deposit required = $431,383.31 Average return required = 3% Investment C: the investment will...
-
A technician is conducting a tensile test on a 1 0 0 3 ( low carbon ) steel specimen. The specimen gage diameter is 1 / 4 " and gage length is I". The sample is found to have first plastically...
-
Calculate the accumulated value of $10879.35 at 7.9% compounded quarterly for 6 years. How much of the amount is interest? Calculate to two decimals. Do not use commas or $ signs. Answer:
-
The heat equation, as given in the introduction, can also be rearranged to calculate the mass or temperature change for a substance. Follow the same steps used to calculate the quantity of heat...
-
The following program does not compile correctly or type check correctly using the comp compiler and type inference system. However, it is a valid Standard ML program. Modify both the comp compiler...
-
discuss why a company might want to repurchase some of its outstanding shares? What benefit could this provide for the company and for shareholders? What is the likely change that would occur to the...
-
An income statement reports the changes in equity attributable to the operation of the business during a specific time period. Revenues increase equity, and expenses decrease equity. Linkworks...
-
Use a calculator to evaluate the expression. Round your result to the nearest thousandth. V (32 + #)
-
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...
-
Generate a regression dataset by sampling a function from a GP prior and then adding some noise. Use ABC to sample from the posterior. Each sample should be generated by first sampling from the GP...
-
For the mixture model where each component is a one-dimensional Gaussian with variance 1 , show that the conditional distribution for the mean of the \(k\) th mixture component is that given by...
-
Implement the Gibbs sampler for the mixture model. Compute \(\hat{R}\) and the autocorrelation of the component means \(\mu_{k}\). How many samples are required for convergence? How much should the...
Study smarter with the SolutionInn App