Return number of rows affected by SQL UPDATE statement in Java

Posted by Krt_Malta on Stack Overflow See other posts from Stack Overflow or by Krt_Malta
Published on 2010-04-03T16:48:23Z Indexed on 2010/04/03 16:53 UTC
Read the original article Hit count: 270

Filed under:
|
|
|
|

I'm using a MySQL database and accessing it through Java.

PreparedStatement prep1 = this.connection.prepareStatement("UPDATE user_table 
                                                               SET Level = 'Super' 
                                                             WHERE Username = ?");
prep1.setString(1, username);

The update statement above works fine however I'd like to get the number of rows affected with this statement. Is this possible please?

© Stack Overflow or respective owner

Related posts about sql

Related posts about update