Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that you have an Oracle database schema named ecommerce, which is hosted on the 1 9 2 . 1 6 8 . 8 8

Assume that you have an Oracle database schema named ecommerce, which is hosted on the 192.168.88.30 server that uses 1523 as DB port. The ecommerce DB has several tables, including the authors table. The Oracle Schema DB user is ecommerce, whereas the DB password is ptuk.
Part 1: Code Complete
The class OracleConnection is not fully written, you need to complete the missing parts -whenever necessary- so that you convert it into functioning code snippets.
Paste or upload the resulting new Java file as part of your answer below.
The file should contain no errors (errors are typically penalized)
//Write down the necessary imports in separate statements!
//All the missing parts should be completed.
..............................
..............................
public class OracleConnection {
static final String DB_URL ="............................................................................................................";
static final String USER =".....................";
static final String PASS ="pwd";
public static Connection getOracleConnection () throws .............................................{
Connection myConn = null;
Class.forName("...............................................................................");
try {
myConn =_______.getConnection(DB_URL, USER, PASS);
}catch (............................................. cne){
cne.printStackTrace();
}catch (............................................ se){
se.printStackTrace();
}catch (Exception e){
e.printStackTrace();
}
return myConn;
}
}
Part 2: Design & Implementation
Given the Java class OracleConnection. Based on the authors table, Author Java class, and the AuthorCRUD Java interface below:
The UML class diagram for the class Author Java bean (class):
Author
- id: long
- title: String
- full_name: String
- double: salary
- int: bcount
+getId(): long
+setId(id: long): void
... the rest of getters and setters placed here
public interface AuthorCRUD {
int addAuthor(Author a);//add new author record to the DB.
}
Your task is to complete the AuthorCRUDOperations Java class below so that you can save an author record to DB. Please take care of insertion status. You should also write a test case (i.e.1 line of code) that shows how to use AuthorCRUDOpertions from the main method.
Upload or paste the resulting Java file as part of your answer.
The file should contain no errors (errors are typically penalized)
public class AuthorCRUDOpertions implements AuthorCRUD
{
public int addAuthor(Author aut){
int status =0;
try (----------------------------------------------
PreparedStatement pstmt =--------------------------------------;)
{
//Write down your code here to insert Author object to DB.
} catch (SQLException se){
se.printStackTrace();
}catch (Exception e){
e.printStackTrace();
}
return status;
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago