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 the jdbc api components?
How do we call a stored procedure from jdbc?
What is sqlwarning?
What are the benefits of PreparedStatement over Statement?
What is a statement?
What is executequery in java?
Explain the locking system in jdbc & its types?
Explain the importance of drivermanager.
When do we use execute method in java jdbc?
Why jdbc is used in java?
any one can explain about policy file rule? when i connect database with applet then ther is no compile time error but the run time error is occureed.i.e access is denied.policy file rule is related to this problem.
How are jdbc statements used?
What are JDBC Best Practices?
How many types of statements are there in jdbc?
Explain about the drive manager class working?