开发者

Keep running a SQL procedure while browsing elsewhere in the application

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 co开发者_高级运维mposed of 4 steps :

  1. deleting users ...
  2. deleting data ...
  3. copying users ...
  4. 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_JOB package that ran the four steps in a separate session. You could either use the DBMS_APPLICATION_INFO package 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 the DBMS_LOCK package (which would be more robust) or by having the front-end check to see if there was a job already submitted in the DBA_JOBS table. Your front-end could then just automatically refresh the page and display the current status.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜