Java.sql.Statement # executeUpdate () vs execute ()?

If I don't care about the number of rows updated, are there any benefits gained with java.sql.Statement#executeUpdate() instead of java.sql.Statement#execute() for the UPDATE statement?

+4
source share
2 answers

My opinion is that there is no difference.

You will not find a single document on the Statement class that indicates that there is a difference in performance between the two commands. Also, as discussed at OTN , people agree that there is no difference between them.

+1
source

The return value is different. ExecuteUpdate() returns the number of updated rows, which may be useful when running the update statement. but you don’t need it. So you can use any of them. Nothing will work out.

+3
source

Source: https://habr.com/ru/post/1484093/


All Articles