在浏览应用程序中的其他位置时继续运行 SQL 过程
我在网络应用程序开发方面面临一个技术问题:
目标如下: 通过单击按钮,用户启动 SQL/Oracle 过程,大约需要 5 到 10 分钟才能成功结束。该过程由 4 个步骤组成:
- 删除用户 ...
- 删除数据 ...
- 复制用户 ...
- 复制数据 ...
程序运行时,用户无法启动第二个步骤,但可以执行任何其他操作完成(浏览应用程序中的其他位置,甚至关闭浏览器)。在每种情况下,该过程都会在后台完成。
这是我面临的技术挑战:
点击后,如果任何用户访问或停留在启动页面,我希望用户看到执行进度的监控( 4 个步骤)。 因此,我必须考虑当用户停留在页面上时对页面进行某种刷新。
Web 应用程序的技术:
- Java/Java EE、Struts、Spring、Oracle SQL9i
- 无 AJAX
您对如何使其工作有什么建议吗?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是让您的应用程序使用在单独会话中运行四个步骤的 DBMS_JOB 包提交作业。您可以使用 DBMS_APPLICATION_INFO 包来检测您的代码,以便前端可以报告当前状态,或者您可以写入单独的日志表并从前端查询该日志表。您可以通过让作业使用 DBMS_LOCK 包获取用户定义的锁(这会更健壮)或通过前端检查是否存在来阻止提交第二个作业。是已在
DBA_JOBS
表中提交的作业。然后,您的前端可以自动刷新页面并显示当前状态。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 theDBMS_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 theDBMS_LOCK
package (which would be more robust) or by having the front-end check to see if there was a job already submitted in theDBA_JOBS
table. Your front-end could then just automatically refresh the page and display the current status.