What is execute(), executeUpdate() and executeQuery()
methods?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
Answer / sree
executeUpdate() is for non selecting statements
executeQuery() is for selecting statements.
| Is This Answer Correct ? | 21 Yes | 18 No |
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 |
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 |
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 |
Answer / sreenivaslu
booleanExecute() method is execute both select and non
select queris are executed
| Is This Answer Correct ? | 7 Yes | 7 No |
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 |
What are devices?
What are the three basic components of the odbc architecture?
Is oracle client required for jdbc connection?
How do you know which driver is connected to a database?
Is it possible to connect to multiple databases simultaneously?
What is a JDBC 2.0 DataSource?
How do I stop nullpointerexception?
How warnings are retrieved in JDBC?
What is connection data?
What is the different between ResultSet and RowSet?
How can you tune SQL statements?
What is metadata in jdbc?