I am posting this message after I go through this question posted below.
http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20538874.htmlWell, i think chainreaction finally statisfy with the help offered by Object and ken. But I have one big and serious question on this. Hope somebody can answer me.
According to the q, chain is asking the proper coding for him to handle this commit() and rollback() issues on AS400..... via WEB-BASED system.
If he is previously running on RPG legacy system, no doubt he can test the commit() and rollback() issues. But how he is going to test either this commint() and rollback() is functioning or not?
What are we talking about about is Web- based application. Can this web-base program commit and rollback? I am doubt. Once user press the submit button, how will him(chainreaction) go to test his program either is it working or not??
He is only commiting or rollback if there is a PROGRAMMING ERROR. And this is not the proper way to test right? What happend if the power failure, in the server orrrrrrrrrrr in the client side? Can this code will function?
Please see this,
con.setAutoCommit(false);
try {
PreparedStatement updateSales = con.prepareStatement("UPDA
TE Book SET SALES = ? WHERE Title LIKE ?");
updateSales.setInt(1, 50);
updateSales.setString(2, "ABC");
updateSales.executeUpdate(
);
PreparedStatement updateInvoice = con.prepareStatement("UPDA
TE Bill SET Amount = ? WHERE Title LIKE ?");
updateInvoice.setInt(1, 2500);
updateInvoice.setString(2,
"LMN");
updateInvoice.executeUpdat
e();
con.commit();
con.setAutoCommit(true);
}
catch (SQLException e) {
con.rollback();
System.out.print(e.printSt
ackTrace()
);
}
He is only catching the error if there is a programming problem. Ha.... Is that what commit() and rollback() for.
So, I am wondering, is that something call rollback() and commit() in WEBASED system. If yes, what would be the best senario to let this command to function. And anohter Q is, this 2 command support client side commit() and rolback??
TQ.