Google News
logo
JDBC - Interview Questions
What is the difference between executing, executeQuery, executeUpdate in JDBC?
execute() method : This method is used to execute SQL DDL statements, it returns a boolean value specifying weather the ResultSet object can be retrieved.
 
executeQuery() : This method is used to execute statements that returns tabular data (example select). It returns an object of the class ResultSet.
 
executeUpdate() : This method is used to execute statements such as insert, update, delete. It returns an integer value representing the number of rows affected.

(Or)

execute() method : it can be used for any kind of SQL Query.
 
executeQuery() : it can be used for select query.
 
executeUpdate() : it can be used to change/update table.
Advertisement