top of page

JDBC – Java Developer Spring Boot

In this question, you have to develop a JDBC code for the following scenario.

Consider two tables – subject and, student shown as follows.

Create a db.sql file and write SQl queries to create the tables ‘subject’ and ‘student.

Complete the code inside the RunningScripts.java file to read the db.sql file. This file runs automatically and creates the tables.

Complete the DbUtil class to create database connections. The dburl to be used is “jdbc:mysql://localhost:3306/mydb”.

Complete the following operations in DbOperations class:
 

  • public boolean insertSubject(String type): Takes a subject name, insert it into the Subject table, and returns a Boolean result.
  • public ArrayList getSubjectById(int id): Returns an ArrayList containing the record data for the given id in the Subject table. For example,[2,’Science’]
  • public ResultSet getAllSubjects(): Returns all the records in the Subject table as a ResultSet.
  • public boolean insertStudent(String student_name, float score, String name):

Takes a student’s name, score, and name(Subject), insert it into the Student table, and returns a Boolean result.

  • public ArrayList getStudentyId(int id): Returns an ArrayList containing the record data for the given id in the Student table. For example,[2,’Smith’,89.0,2].
  • public ResultSet getAllStudents(): Returns all the records in the Student table as a ResultSet.

TCS Hackerrank Java Developer Spring boot JDBC Solution

$30.00Price
  • You will get all the code and Solution in a PDF file.
    Please visit the images and description.

bottom of page