What is execute(), executeUpdate() and executeQuery()
methods?
Answer Posted / 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 |
Post New Answer View All Answers
What is sqlwarning and discuss the procedure of retrieving warnings?
Does jdbc require oracle client?
What protocol does jdbc use?
What is resultset?
Can we return resultset in java?
What packages are used by jdbc?
What is the return type of class.forname() method?
What is the JDBC?
How do I disallow NULL values in a table?
Explain the various types of locking system in jdbc?
What is JDBC Driver interface?
What is jsp and jdbc?
Why we use jdbc instead of odbc?
What is jdbc odbc bridge in java?
Is jdbc a web technology?