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 are different types of ResultSet?
Give an example for getXXX method?
Explain about the Try Block?
Why isn't the java.sql.DriverManager class being found?
Why do we need jdbc api?
Name the new features added in jdbc 4.0.
What is data source in java?
What is jdbc driver?
What is addbatch jdbc?
Does sql allow null values ?
How can you make a connection?
How many locking systems are there in jdbc?
How can I manage special characters when I execute an insert query?
How many jdbc driver types are there?
Which database is used for java?