on-internet
← Community

How to tell number of rows changed from JDBC execution

Stack Overflow ·

I'm uncertain as to how to get the number of rows affected from a SQL execution. I do like this: boolean isResultSet = statement.execute(arbitrarySQLCommand); and I can get the number of rows affected from the getUpdateCount() method. That is all fine. The problem I have is when update count is zero. This can either mean: It was a DML statement but it didn't affect any rows. Zero rows affected is a valid response. I just means that some condition was not met. It was a non-DML statement (DDL statement most likely) .. which by definition does not change rows so therefore update count is always z

Comments

Sign in or sign up to comment and upvote.

No comments yet.