0% found this document useful (0 votes)
8 views3 pages

Adv Java Exp-3

Uploaded by

Pinku 230
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)
8 views3 pages

Adv Java Exp-3

Uploaded by

Pinku 230
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
You are on page 1/ 3

Name Of The Experiment :

*Coding Phase: Pseudo Code / Flow Chart / Algorithm :


Update Student Data :-
1. Start
2. Initialize branch to "BBA" and registrationId to 18
3. Load JDBC Driver
4. Establish Database Connection
5. Prepare SQL Update Statement
6. Set branch and registrationId parameters
7. Execute Update Statement
8. Update successful?
• Yes: Print "Successfully Updated"
• No: Print "Failed"
9. End
Delete Student Data :-
1. Start
2. Initialize registrationId to 18
3. Load JDBC Driver
4. Establish Database Connection
5. Prepare SQL Delete Statement
6. Set registrationId parameter
7. Execute Delete Statement
8. Deletion successful?
• Yes: Print "Deletion Success"
• No: Print "Deletion Failed"
9. End

* Testing Phase: Compilation of Code (error detection):

As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning

*Implementation Phase:Final Output (No Error)


Update.java :-
package Update.com;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Update {

public static void main(String[] args) throws Exception{


// TODO Auto-generated method stub
String branch = "BBA";
int registrationId = 18;
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database1","root","Arman5656");
System.out.println("Successfully loaded");
PreparedStatement ps = con.prepareStatement("Update registration set branch=? where registrationId=?");
ps.setString(1, branch);
ps.setInt(2, registrationId);
int i = ps.executeUpdate();

if(i > 0) {
System.out.println("Successfully Updated");
} else {
System.out.println("Failed");
}
}

}
Delete.java :-
package delete.com;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Delete {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
int registrationId = 18;
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database1","root","Arman5656");
System.out.println("Succesfully Loaded");
PreparedStatement ps = con.prepareStatement("Delete from registration where registrationId=?");
ps.setInt(1, registrationId);
int i = ps.executeUpdate();
if (i >0) {
System.out.println("Deletion Success");
} else {
System.out.println("Deletion Failed");
}
}
}

As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning

* Final Output (no error) :


Updation in Table :-

Deletion From Table :-

Rubrics FULL MARK

Concept 10
Planning and Execution/ 10
Practical Simulation/ Programming
Result and Interpretation 10
Record of Applied and Action Learning 10
Viva 10
Total 50

Signature of the Faculty: Signature of the Student:

*As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.

You might also like