How to determine whether a SQL (UPDATE,DELETE) statement executes a successful catch (SQLException e) {
}
You should succeed if you don't catch the error.
=====================================================================
The statement object provides three ways to execute SQL statements.
1.ResultSet executeQuery (String sql)
Executes a query statement, such as ResultSet rs=stmt.executequery (SELECT * FROM table_name ").
2.int executeupdate (String sql)
Executes an UPDATE statement such as INSERT, UPDATE, Delete, and returns the number of records for the operation.
3.boolean execute (String sql)
Executes all SQL statements, returning the success of the execution operation.
So for insert,update, and so on, after executing with executeupdate, if the value returned is 0, it will fail, and a positive integer succeeds, and the third method will not need to say more.
How to tell if a SQL (UPDATE,DELETE) statement is performing successfully