Difference between executeUpdate and executeQuery Methods



Q) What is the difference between executeUpdate and executeQuery Methods?

Rep) We must use executeQuery for executing the ‘select’ statement and executeUpdate for executing ‘non-select’ statement(CURD) etc

CURD is nothing but

C :- Create (insert—->statement)

U :- Update (update—–>statement)

R :- Read (select——->statement)

D :- Delete (delete——>statement)

for Ex: we can provide the code as shown below to perform create operation

Statement stmt=con.createStatement();

String Vsql=”insert into student values(200,’ram’,22,’ampet’);

stmt.executeUpdate(Vsql);

Random Posts

  • Which of the Collection Classes will not allow duplicate values
  • Define Hashtable,HashMap and HashSet
  • Maintaining Servlet Session and EJB Session
  • Difference between session.save() , session.saveOrUpdate() and session.persist()
  • Difference between session.update() and session.lock()

Post a Comment