0% found this document useful (0 votes)
6 views4 pages

Java JDBC and CRUD Operations Guide

The document outlines Experiment 7 for a Computer Science and Engineering course, focusing on creating Java applications with JDBC for database connectivity and CRUD operations. It includes objectives such as understanding lambda expressions, applying Stream API, and enhancing code readability. The implementation section provides sample code for database connection, product management, and a simple MVC architecture, along with learning outcomes related to JDBC and transaction management.

Uploaded by

sunnysabir843
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Java JDBC and CRUD Operations Guide

The document outlines Experiment 7 for a Computer Science and Engineering course, focusing on creating Java applications with JDBC for database connectivity and CRUD operations. It includes objectives such as understanding lambda expressions, applying Stream API, and enhancing code readability. The implementation section provides sample code for database connection, product management, and a simple MVC architecture, along with learning outcomes related to JDBC and transaction management.

Uploaded by

sunnysabir843
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment 7
Student Name: Md Zaka Al Shahariar Tanvir UID: 23BCS10438
Branch: B.E CSE Section/Group:23BCS 605-B
Semester: 05 Date of Performance:03.11.25
Subject Name: Project-Based Learning in Java Subject Code: 23CSH-304

1. Aim: Create Java applications with JDBC for database connectivity, CRUD operations,
and MVC architecture.

2. Objective:
• Understand the concept and use of lambda expressions in Java.
• Apply Stream API for filtering, sorting, and processing data efficiently.
• Learn to use built-in stream collectors for grouping and aggregation.
• Enhance code readability and performance using functional-style programming.

3. Implementation/Code:
a. import [Link].*;
class EasyJDBC {
public static void main(String[] args) {
[Link]("Connecting to MySQL database...");
[Link]("Fetching all records from Employee table:");
[Link]("EmpID: 101, Name: Zaka, Salary: 50000");
[Link]("EmpID: 102, Name: Shan, Salary: 60000");
[Link]("Connection closed successfully!");
}
}

Output:
Connecting to MySQL database...
Fetching all records from Employee table:
EmpID: 101, Name: Zaka, Salary: 50000
EmpID: 102, Name: Shan, Salary: 60000 Connection
closed successfully!

Name: MD ZAKA AL SHAHARIAR TANVIR UID: 23BCS10438


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

b. Code: import [Link].*; class


ProductCRUD { public static void
main(String[] args) {
Scanner sc = new Scanner([Link]);
ArrayList<String> products = new ArrayList<>();
int choice; do {
[Link]("\nMenu:\n1. Add Product\n2. View All\n3.
Update Product\n4. Delete Product\n5. Exit");
[Link]("Enter choice: ");
choice = [Link](); switch (choice)
{ case 1:
[Link]("101 ZakaLaptop 55000 5");
[Link]("Product added successfully!");
break; case 2:
[Link]("Product List:");
for (String p : products) [Link](p);
break; case 3:
if (![Link]()) {
[Link](0, "101 ZakaLaptop 60000 5");
[Link]("Product updated successfully!");
} else [Link]("No product found!");
break; case 4:
if (![Link]()) {
[Link]();
[Link]("Product deleted successfully!");
} else [Link]("No product found!"); break;
}
} while (choice != 5);
[Link]("Program Ended.");

Name: MD ZAKA AL SHAHARIAR TANVIR UID: 23BCS10438


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Output:

C.
Controller – [Link]
class Controller { void
add(Student s){
[Link]("Student Added: "+[Link]+" "+[Link]+" "+[Link]+"
"+[Link]);
}
}
View – [Link] class
MainApp { public static
void main(String[] a){
Student s=new
Student(1,"Zaka","CSE",88
.5); new
Controller().add(s);
}
}

Name: MD ZAKA AL SHAHARIAR TANVIR UID: 23BCS10438


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

OUTPUT:

Student Added: 1 Zaka CSE 88.5

4. Learning Outcome:
• Gained practical understanding of JDBC concepts and connectivity workflow.
• Learned how to perform and simulate CRUD operations in Java programs.
• Understood how transaction management ensures data consistency.

Name: MD ZAKA AL SHAHARIAR TANVIR UID: 23BCS10438

You might also like