Perhaps a better way to do this than have 3 update requests and a trans_start and trans_commit is to write a single stored procedure on the database, and execute it with a PreparedStatement.
This has a LOT of performance benefit. For one, you have less remote calls from the
Java app to the DB. Secondly, the stored procedure is pre-compiled and can be quickly executed. Executing raw SQL from
JDBC suffers from having to compile the query each time, only to throw it away.
If you're executing the same query with different parameters repetedly,
you should definitely be using PreparedStatements.
The above is from my work with oracle. Not sure how it applies to other systems, though I suspect it should be the same.
- kashif Q.