I am facing a technical issue on a web-app development :
Here is the goal :
By clicking on a button, the user launches a SQL/Oracle procedure that takes about 5 to 10 minutes to come to an end successfully. The procedure is composed of 4 steps :
- deleting users …
- deleting data …
- copying users …
- copying datas …
While the procedure is running, the user can’t launch a second one, but any other thing can be done (browsing elsewhere in the application, even shutting-down the browser). In every situation, the procedure completes in the background.
Here is the technical challenge for me :
After clicking, if any user access or stay on the launching page, I want the user to see the monitoring of the execution progressing (the 4 steps).
Thus, I’ve got to think about some kind of a refresh of the page when the user stays on it.
Technologies of the web-app :
- Java/Java EE, Struts, Spring, Oracle SQL9i
- NO AJAX
Do you have any suggestion on how to make it work ?
Thanks.
The simplest possible approach would be to have your application submit a job using the
DBMS_JOBpackage that ran the four steps in a separate session. You could either use theDBMS_APPLICATION_INFOpackage to instrument your code so that the front end can report on the current status or you could write to a separate log table and query that log table from the front-end. You could prevent a second job from being submitted either by having the job acquire a user-defined lock using theDBMS_LOCKpackage (which would be more robust) or by having the front-end check to see if there was a job already submitted in theDBA_JOBStable. Your front-end could then just automatically refresh the page and display the current status.