Is it a good idea to re-use java.sql.Statement object to execute multiple queries in multiple threads simultaneously?
I've read somewhere that it's recommended to reuse same statement object, however it was sequential execution.
Statement statement = con.createStatement();
Now if I use this single statement instance to run executeUpdate()
for multiple queries in multiple threads simultaneously?
Note that it's not PreparedStatement and I am not getting any ResultSet.
I think answer depends on two scenarios:
- If queries are mutually exclusive, then it should be okay.
- If queries are working on same set of data, then there may be issues.
Is my understanding correct?
Thanks.