Experiment -3.
Student Name: Harjit Singh Dhillon UID: 20BCS6512
Branch: AIML Section/Group: 20AIML 3A
Semester: 4th
Subject Name: Java Lab Subject Code: 20-csp-287
1. Aim of the practical:
Create a console based application using Java as frontend and Oracle as backend for their
Inventory and Sales maintenance.
2. Apparatus Required: VS Code/ Eclipse IDE/ IntelliJ IDEA
3. Code:
import [Link].*;
import [Link];
public class SQL {
public static void main(String[] args) {
try{
String name1=null;
String prod=null;
int qt;
@SuppressWarnings("resource")
Scanner sc=new Scanner([Link]);
[Link]("Enter the name of customer,product and quantity:");
[Link]();
name1=[Link]();
prod=[Link]();
qt=[Link]();
[Link]("[Link]");
Connection
con=[Link]("jdbc:mysql://localhost:3306/aryangupta","root","ag1234");
Statement stmt=[Link]();
PreparedStatement ps=[Link]("insert into inventory values(?,?,?)");
[Link](1,name1);
[Link](2,prod);
[Link](3,qt);
[Link]();
[Link]("Successfully Inserted!");
ResultSet rs=[Link]("select * from inventory");
[Link]("Contents of the Table Inventory are:");
while([Link]())
[Link]([Link](1)+" "+[Link](2)+" "+[Link](3));
[Link]("Successfully Inserted!");
[Link]();
}catch(Exception e){ [Link](e);}
}
4. Output:
Learning outcomes (What I have learnt):
1. I have learnt about oracle
2. I have learnt about JDBC
3. I have learnt how to connect frontend and backend
4. I have learnt about different drivers.
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):
Sr. No. Parameters Marks Obtained Maximum Marks
1.
2.
3.