Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the Java program to create a Horse table, insert one row, and display the row. The main program calls four methods: 1. createConnection

   

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

Step by Step Solution

3.46 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

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

Linear Algebra

Authors: Jim Hefferon

1st Edition

978-0982406212, 0982406215

More Books

Students also viewed these Programming questions

Question

Verify Lemma 1.9 for 2 2 matrices by direct calculation.

Answered: 1 week ago