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
Which jdbc driver is the fastest driver?
How do I load a database driver with JDBC 4.0 / Java 6?
What is jdbc servlet?
What is JDBC Savepoint? How to use it?
What is jdbc and odbc in java?
What are the utilities of the callablestatement?
What is jdbc connection?
What is the use of setFetchSize() and setMaxRows() methods in Statement?
What does jdbc setmaxrows method do?
What is the difference between setmaxrows(int) and setfetchsize(int)?
What are 4 drivers available in JDBC? At what situation are four of the drivers used?
How many types of jdbc drivers are available?
If I use the JDBC API, do I have to use ODBC underneath?
Explain the difference between inner and outer join ?
Is jdbctemplate thread safe?