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

What is the execute method in java?

0 Answers  


What is PreparedStatement?

6 Answers   Infogain, Wipro,


Describe odbc?

0 Answers  


what are the advantages of JDBC?

7 Answers  


all Java qts are imp ?

1 Answers   eBay,


Can I use JDBC to execute non-standard features that my DBMS provides?

0 Answers  


How do I insert/update records with some of the columns having NULL value?

0 Answers  


Why prepared statements are faster?

0 Answers  


which scenarios we go for jdbc,and which scenario we go for connection polling and wat r advantages and disadvantages using connection pooling.

2 Answers   TCS,


How are jdbc statements used?

0 Answers  


Where jdbc drivermanager class is used?

0 Answers  


What is jdbc odbc?

0 Answers  


Categories