I am working on a legacy jsp web application that uses JDBC and inline SQL Statements.
We are having an issue with incorrect data in the database and I am wondering if it is possible for two statements to be executed in a different order than the order that they are specified in the code. i.e. if we have two update statements that are run like the following example.
String sql1 = "update table set x = y";
String sql2 = "update table set z = a";
Statement statement = conn.createStatement();
db_wrapper.runSQL(sql1,statement);
db_wrapper.runSQL(sql2,statement);
Is it possible that under heavy load the second sql statement will be run before the first one by the database.
The install we are mostly having the problem with runs on an oracle database.
Also the code currently does not use transactions.
No, that thread will call Oracle driver in that order, there is no explicit reordering of method calls, nor reordering or queries in JDBC.
However :