I’m using JDBC with mysql. I can get my queries to work great.
But for update queries for instance I was wondering if there was any way to determine whether the update was successful for for example if the row could not be found.
UPDATE TABLE SET column = 'newvalue' WHERE primary_key =2
I would like to get the specific error message if possible, this way I can throw a specific exception as to why the query failed.
Thanks for your help.
executeUpdate() will return the number of rows that were affected by your SQL statement:
Of course you could have found out yourself by simply looking at the JavaDocs: