Question: You are assigned to develop a mobile responsive web application to aid contact tracing in response to COVID-19 pandemic. This application will be used at

You are assigned to develop a mobile responsive web application to aid contact tracing in response to COVID-19 pandemic. This application will be used at the Perdana Mall Skudai. Customers who come to Perdana Mall will need to enter their personal information such as name, phone number, shop name and temperature. You are using mySQL database to store information. The name of the database is dbPerdana, and uname is the username and password. There are three tables used in the dbPerdana database, namely tblShop, tblScan and tblCustomer. Table 1a shows the required tables and columns information.

You are assigned to develop a mobile responsive web application to aid

contact tracing in response to COVID-19 pandemic. This application will be used

Table la: Tables and columns No. Table Column 1. tblCustomer [ID] INT IDENTITY (1, 1) NOT NULL (PK) [Id_Scan] NCHAR (8) NULL [Id_Shop] NCHAR (8) NULL [Name] NVARCHAR (35) NULL [Phone] VARCHAR (12) NULL 2. tblShop 3. tblScan [Id_Shop] NCHAR (8) NOT NULL (PK) [Shop] NVARCHAR (35) NULL [Id_Scan] NCHAR (8) NOT NULL (PK) [Temperature] NVARCHAR (15) NULL Legend: (PK) - Primary Key Answer the following questions: a) Write a code to create a database named dbPerdana. You need to use the JDBC connectivity and its file name is Perdana jdbc.java. (4 marks) b) Assuming your program has successfully loaded the appropriate JDBC driver and established the connection to dbPerdana database, write a fragment of Java source code that will display all data found in tblCustomer. You must write TWO (2) different fragments of Java source code to display all data found in tblCustomer using: i) Statement object ii) PreparedStatement object (Note: Each fragment of the Java source code must include Java statements for Statement/PreparedStatement object declaration, SQL query creation and the execution of the SQL query). (8 marks) Table la: Tables and columns No. Table Column 1. tblCustomer [ID] INT IDENTITY (1, 1) NOT NULL (PK) [Id_Scan] NCHAR (8) NULL [Id_Shop] NCHAR (8) NULL [Name] NVARCHAR (35) NULL [Phone] VARCHAR (12) NULL 2. tblShop 3. tblScan [Id_Shop] NCHAR (8) NOT NULL (PK) [Shop] NVARCHAR (35) NULL [Id_Scan] NCHAR (8) NOT NULL (PK) [Temperature] NVARCHAR (15) NULL Legend: (PK) - Primary Key Answer the following questions: a) Write a code to create a database named dbPerdana. You need to use the JDBC connectivity and its file name is Perdana jdbc.java. (4 marks) b) Assuming your program has successfully loaded the appropriate JDBC driver and established the connection to dbPerdana database, write a fragment of Java source code that will display all data found in tblCustomer. You must write TWO (2) different fragments of Java source code to display all data found in tblCustomer using: i) Statement object ii) PreparedStatement object (Note: Each fragment of the Java source code must include Java statements for Statement/PreparedStatement object declaration, SQL query creation and the execution of the SQL query). (8 marks)

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 Databases Questions!