We have a Java code similar to the following:
PreparedStatement stmt = connection.prepareStatement("drop login tmp");
int result = stmt.executeUpdate();
When running through a debugger, it seems that our SQL statement is executed after the first line is executed, and even before the second line is executed. When the second line is executed, the drop SQL is executed again, and is causing an error, as the username tmp no longer exist.
This only happens against SQL Server, but not against Oracle and Postgres with similar drop SQL queries.
Is this a known problem? Is there a common workaround, other than moving to Statement instead of PreparedStatement?