Answered step by step
Verified Expert Solution
Question
1 Approved Answer
LAB ACTIVITY 1 0 . 1 . 1 : LAB - Database programming with Java Complete the Java program to create a Horse table, insert
LAB
ACTIVITY
: LAB Database programming with Java
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:
Database: zybooksdb
Password is not necessary and can be omitted.
createTable creates Horse, with five columns:
ID integer, primary key, not null
Name varchar
Breedvarchar
Heightdouble
Birthdatevarchar
Before creating Horse, drop the table if the table exists from a prior run
insertHorse inserts one row into Horse:
'Babe', 'Quarter horse',
selectAllHorses selects and prints all Horse rows, as follows:HINT: Use import java.sq to access all classes and methods of the JavaSQL API. Calls to these methods may throw exceptions and must be enclosed in the try block of a trycatch statement.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started