Re: Servlet deleting web folders & DB2 data.
Thursday, March 20, 2003 04:50 AM
as such, there cannot be a standard-common way of designing your application, as every application is different.. at the most we can take help of some design patters..
as far as ur problem is concerned, IMHO, the last option you suggested is the best approach.. delete an entry from the db and then delete an entry from the file-system.. repeating the same for all the enteries...
ideal way would be... you have a try - catch inside the for loop, which handles every deletion separately.. set the db-connection's auto-commit to false..delete the record from the db.. if that itself throws an exception folder-deletion is not going to be executed at all.. if folder-deletion gives you a IOException, rollback the db as well... this shouold preserve the integrity...