Question: Complete the Java program to create a Horse table, insert one row, and print the row. Implement the following methods. Method parameters are described in

Complete the Java program to create a Horse table, insert one row, and print the row.
Implement the following methods. Method parameters are described in the template. Do not modify the main program.
createConnection() creates a connection to the database. This method calls DriverManager.getconnection () with the
following connection information:
User: root
Server address: 127.0.0.1
Database: zybooksdb
Password is not necessary and can be omitted.
createTable() creates Horse, with five columns:
ID - integer, primary key, not null
Name - varchar(30)
Breed - varchar(30)
Height-double
Birthdate - varchar(10)
Before creating Horse, drop the table if the table exists (from a prior run).
insertHorse () inserts one row into Horse:
(1, 'Babe', 'Quarter horse', 15.3,'2015-02-10')
selectAllHorses () selects and prints all Horse rows, as follows:
All horses:
(1, 'Babe', 'Quarter Horse', 15.3,'2015-02-10')
HINT: Use import java.sql.* to access all classes and methods of the Java-SQL API. Calls to these methods may throw exceptions and must be enclosed in the try block of a try-catch statement.
Complete the Java program to create a Horse

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!