How to know number of rows affected when updating data in database table?
In this example you can see how to get number of rows or records affected when we are trying to update records in the database. The executeUpdate method of Statement or PreparedStatement return an integer value which tell us how many records was affected by the executed command.
Note that when the return value for executeUpdate is 0 , it can mean one of two things: (1) the statement executed was an update statement that affected zero rows, or (2) the statement executed was a DDL statement such as statement to create a table in database.
1 row(s) updated!