How safe is it to use multiple consecutive executeUpdate() methods on SQL database?
Considering 2 statements:
st.executeUpdate("INSERT table SELECT col1,col2 FROM table WHERE ID=" +var_id);
st.executeUpdate("DELETE FROM table WHERE ID=" +var_id);
How does they behave? Does the 2nd statement wait for the completion of 1st or should we check for the returned value (number of rows affected) and act accordingly with 2nd statement?
A call to executeUpdate
is not asynchronous, so it will not return until after the statement has been executed on the server. In other words: these two statements will work and they will not interfere as they are executed one after the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With