Questions for Lab Assignment 6 Solved

$24.99 $18.99

INSTRUCTIONS This lab is graded. Use the student database that was created in Lab1. Instructions for downloading JDBC driver for MySQL: Download JDBC connector from https://dev.mysql.com/downloads/connector/j/ For Linux: Install using sudo apt install <.deb> file Your .jar will be in /usr/share/java Set your CLASSPATH using the following command (for bash): export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java-8.0.15.jar To start a…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)
  • INSTRUCTIONS

    1. This lab is graded.

    1. Use the student database that was created in Lab1.

    1. Instructions for downloading JDBC driver for MySQL:

      1. Download JDBC connector from https://dev.mysql.com/downloads/connector/j/ For Linux: Install using sudo apt install <.deb> file

      2. Your .jar will be in /usr/share/java

Set your CLASSPATH using the following command (for bash):

export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java-8.0.15.jar

      1. To start a connection, use the following code:

String url = “jdbc:mysql://localhost:3306/<your database name>”; String username = “<your user name>”;

String password = “<your password>”;

Connection conn= DriverManager.getConnection(url, username, password);

  • QUESTION 1

Consider the following relations:

Student(snum: integer, sname: string, major: string, level: string, age: integer)

Class(name: string, meets_at: time, room: string, fid: integer)

Enrolled(snum: integer, cname: string)

Faculty (fid: integer, fname: string, deptid: integer)

The meaning of these relations is straightforward; for example, Enrolled has one record per student-class pair such that the student is enrolled in the class.

  1. Write a Java application that lists all the tables and asks the user to select a table to print. Upon selection, the application must print the contents of the selected table in tabular form. [5 Marks]

  1. Write a Java application that runs the queries given below. Your application must handle error cases. If a query returns an error, the error must be displayed to the user. (Alternatively, you may write a separate application for each query.) [3*5=15 Marks]

    1. Ask the user to specify the name of a room. Print the names of all classes that meet in that room.

    1. Ask the user to specify the name of a course. Print the rooms and the times at which classes for that course will be conducted.

    1. Ask the user to specify the name of a faculty member. Print the names of the courses that that faculty member teaches.

.

1

Questions for Lab Assignment 6 Solved
$24.99 $18.99