
public String studentDel(StudentBean studObj) throws ClassNotFoundException, SQLException
{
Connection conObj=DBConnections.setConnection();
PreparedStatement ps= conObj.prepareStatement("DELETE FROM balastudent WHERE studentid=?");
ps.setString(1, studObj.getStudentId());
System.out.println(studObj.getStudentId());
ps.executeUpdate();
return "Success";
}
public String studentIns(StudentBean studObj) throws ClassNotFoundException, SQLException
{
Connection conObj=DBConnections.setConnection();
Statement sObj = conObj.createStatement();
ResultSet rObj=sObj.executeQuery("select studentId.nextval from dual");
rObj.next();
String studentId=rObj.getString(1);
PreparedStatement ps= conObj.prepareStatement("insert into balastudent values (?,?,?,?)");
ps.setString(1, studentId);
ps.setString(2, studObj.getStudentName());
ps.setString(3, studObj.getStudentAge());
ps.setString(4, studObj.getStudentCollege());
ps.executeUpdate();
return "Success";
}
public ResultSet studentSearch(StudentBean studObj) throws ClassNotFoundException, SQLException
{
Connection conObj=DBConnections.setConnection();
PreparedStatement ps= conObj.prepareStatement("select * from balastudent where studentId=?");
ps.setString(1,studObj.getStudentId());
ResultSet rs = ps.executeQuery();
return rs;
}
public String studentUpd(StudentBean studObj) throws ClassNotFoundException, SQLException
{
Connection conObj=DBConnections.setConnection();
PreparedStatement ps= conObj.prepareStatement("update balastudent set studentname=?,studentage=?,studentcollege=? where studentid=?");
ps.setString(1, studObj.getStudentName());
ps.setString(2, studObj.getStudentAge());
ps.setString(3, studObj.getStudentCollege());
ps.setString(4, studObj.getStudentId());
ps.executeUpdate();
return "Success";
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.