--insert--
try {
int id = [Link]([Link]());
String name = [Link]();
String phone = [Link]();
String email= [Link]();
int age = [Link]([Link]());
[Link]("[Link]");
Connection c =
[Link]("jdbc:oracle:thin:@localhost:1521:XE", "hr", "hr");
String sql = "insert into student2 VALUES(?,?,?,?,?)";
PreparedStatement stmt = [Link](sql);
[Link](1, id);
[Link](2, name);
[Link](3, phone);
[Link](4, email);
[Link](5, age);
int rows = [Link]();
[Link](rows + "added");
[Link]();
[Link]();
} catch (ClassNotFoundException ex) {
[Link]([Link]());
} catch (SQLException ex) {
[Link]([Link]());
}
}
-----------------------------------------------------
--update--
try {
int id = [Link]([Link]());
String name = [Link]();
String phone = [Link]();
String email = [Link]();
int age = [Link]([Link]());
[Link]("[Link]");
Connection c =
[Link]("jdbc:oracle:thin:@localhost:1521:XE", "hr", "hr");
String sql = "update student2 set"
+ " name = ? , phone = ? ,"
+ "email = ? ,age = ?"
+ "where id = ?";
PreparedStatement stmt = [Link](sql);
[Link](1, name);
[Link](2, phone);
[Link](3, email);
[Link](4, age);
[Link](5, id);
int rows = [Link]();
[Link](rows + "added");
[Link]();
[Link]();
} catch (ClassNotFoundException ex) {
[Link]([Link]());
} catch (SQLException ex) {
[Link]([Link]());
}
}