What is execute(), executeUpdate() and executeQuery()
methods?

Answers were Sorted based on User's Feedback



What is execute(), executeUpdate() and executeQuery() methods?..

Answer / srinivasan

execute() - will do the querying the database & also the
update,insert,delete on the database.

executeUpdate() - only the update,insert,delete on the
database.

executeQuery() - only the querying the database.

Is This Answer Correct ?    80 Yes 23 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / bhoopesh alladi

execute()- is for invoking the functions or stored
procedures of SQL by the CallableStatement.

executeUpdata()- is for the operations such as insert,
update or delete on SQL by PreparedStatement, Statement.

executeQuery() - is for operation select of Sql by
PreparedStatement or Statement.

Is This Answer Correct ?    69 Yes 21 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / trio

boolean execute()
Executes the SQL statement in this PreparedStatement
object, which may be any kind of SQL statement.

ResultSet executeQuery()
Executes the SQL query in this PreparedStatement object and
returns the ResultSet object generated by the query.

int executeUpdate()
Executes the SQL statement in this PreparedStatement
object, which must be an SQL INSERT, UPDATE or DELETE
statement; or an SQL statement that returns nothing, such
as a DDL statement.

Is This Answer Correct ?    39 Yes 4 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / kirthi

executeQuery() --- This is used generally for reading the
content of the database. The output will be in the form of
ResultSet. Generally SELECT statement is used.

executeUpdate() --- This is generally used for altering the
databases. Generally DROP TABLE or DATABASE, INSERT into
TABLE, UPDATE TABLE, DELETE from TABLE statements will be
used in this. The output will be in the form of int. This
int value denotes the number of rows affected by the query.

execute() --- If you dont know which method to be used for
executing SQL statements, this method can be used. This
will return a boolean. TRUE indicates the result is a
ResultSet and FALSE indicates it has the int value which
denotes number of rows affected by the query.

Is This Answer Correct ?    22 Yes 1 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / sree

executeUpdate() is for non selecting statements
executeQuery() is for selecting statements.

Is This Answer Correct ?    21 Yes 18 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / boomiraj.p

executeUpdate() : is used to update the data using "insert,update and delete" statements.Send the data from fron t end to back end.

executeQuery() : used to select the data using "select" statement.Retrieve the data from back end to front end.

Is This Answer Correct ?    6 Yes 5 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / ratheesh.a

executeQuery(): This is a method/function used in jdbc
programs. this method will return a 'Resulset' object.
Through this method we can access the result of the query
Usually the Select query is used here..




executeUpadte(): This method is mainly used for updating
queries.. such as 'insert,update,delete' etc... returns an
integer value which shows how many rows are updated...


execute() :What ever the sql queries we are giving in the
other 2 methods can also be include here
This will return a boolean value if it returns 'true' means
query executed successfuly else not..

Is This Answer Correct ?    4 Yes 3 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / kundlik

execute():-execute method is used to fire DDL Command means (CREATE,ALTER,DROP Etc) on to the database,It's return type is true or false.

executeUpdate():Its used to fired DML Command on to the database. like (insert,update,delete) etc.its return type is ResultSet.


executeQuery():is used to only retrieve data from database.

Is This Answer Correct ?    1 Yes 0 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / sreenivaslu

booleanExecute() method is execute both select and non
select queris are executed

Is This Answer Correct ?    7 Yes 7 No

What is execute(), executeUpdate() and executeQuery() methods?..

Answer / bharat

executeUpdata()= is for the operations such as Insert,
update and delete on SQL by PreparedStatement or Statement.

executeQuery()= is for operation select of Sql by
PreparedStatement or Statement.

Is This Answer Correct ?    5 Yes 6 No

Post New Answer

More JDBC Interview Questions

how many JDBC drivers ?name them?

6 Answers   CTS, Idea,


What is jdbc and its types?

0 Answers  


What type of drivers have you used?

1 Answers  


DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality. What can I do?

0 Answers  


Diff bet.. Function and Trigger?

3 Answers   Logica CMG,






How a database driver can be loaded with jdbc 4.0 / java 6?

0 Answers  


How can you know about drivers and database information ?

0 Answers  


What are types of jdbc drivers?

0 Answers  


What is jdbc oracle thin?

0 Answers  


Give me some example for getting connection from connection pooling in JBoss Server. Is Connection Pool default in Server or we have to create it? Who can create Connection Pool in a Team. How it will be accessed by the developer code?

1 Answers   TCS,


Is there another way of dealing with the result set that could execute faster?

0 Answers  


What are jdbc and its components?

0 Answers  


Categories