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

Java JDBC and CRUD Operations Guide

The document outlines Experiment 7 for a Computer Science and Engineering course, focusing on Java applications with JDBC for database connectivity and CRUD operations. It includes objectives related to lambda expressions, Stream API, and functional programming, along with sample code for database connection and product management. The learning outcomes highlight practical understanding of JDBC, CRUD operations, 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 DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

Java JDBC and CRUD Operations Guide

The document outlines Experiment 7 for a Computer Science and Engineering course, focusing on Java applications with JDBC for database connectivity and CRUD operations. It includes objectives related to lambda expressions, Stream API, and functional programming, along with sample code for database connection and product management. The learning outcomes highlight practical understanding of JDBC, CRUD operations, 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 DOCX, PDF, TXT or read online on Scribd

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment 7
Student Name: MD Shan E Islam UID: 23BCS10403
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 Shan E Islam UID: 23BCS10403


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);

Name: MD Shan E Islam UID: 23BCS10403


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

[Link]("Program Ended.");
}

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 Shan E Islam UID: 23BCS10403


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 Shan E Islam UID: 23BCS10403

You might also like