Search code examples
javamysqljdbcresultset

What does java return in resultset in case of mysql update query


I need to know did the update query go wrong or right, i know how to do it in PHP, but have no idea in java (I'm new to java).


Solution

  • It returns:

    1. The number of affected rows in the resultset if the query is a DML query (insert, update, delete)
    2. 0, if the query is a DDL (create, alter, etc.)

    See the javadoc for more details: Execute Update Javadoc

    And I strongly advise you to read the related section in JDBC Tutorial, read the section titled: Return Values for the executeUpdate Method