Oracle数据库:DBMS_ALERT用法与java应用程序 [英] Oracle database: DBMS_ALERT usage with java application

查看:333
本文介绍了Oracle数据库:DBMS_ALERT用法与java应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java应用程序服务器使用JDBC与oracle 11.2数据库服务器通信。客户端的请求发送到应用程序服务器,应用程序服务器运行调用数据库中的第一个存储过程的java方法。

I have a java application server communicating with an oracle 11.2 database server using JDBC. A client's request is send to the application server, which runs a java method that calls a first stored procedure in the database.

我想要java方法,在调用存储过程后,等待来自数据库的信号(信号表明一些结果已准备好从数据库)。

I want the java method, after calling the stored procedure, to sit and wait for a signal from the database (the signal indicates that some result is ready for retrieving from the database).

为了避免轮询数据库,可以使用DBMS_ALERT来通知java方法(或多个方法,因为多个实例可能正在运行,每个唯一用户有一个实例)准备检索,在这种情况下,java方法可以继续执行其余的代码?

To avoid polling the database, can DBMS_ALERT be used to inform the java method (or methods, since multiple instances may be running, one instance per unique user) that the result is ready to retrieve, in which case the java method can proceed executing the rest of its code?

有人可以提供一个使用DBMS_ALERT的简单示例吗?也就是说,如何在数据库中配置它,使得当表中的预定字段改变(例如到预定值,例如完成)时发送警报,以及如何配置java方法,使得它可以接收警告消息(包括如何处理此消息以检查其内容,例如 if(received_message =='done')等)?

Can someone provide a simple example of using DBMS_ALERT in this scenario? That is, how to configure it in the database such that an alert is sent when a predetermined field in a table changes (e.g. to a predetermined value, e.g. 'done'), and how to configure the java method such that it can receive an alert message (including how it processes this message to examine it's contents, e.g. if (received_message == 'done') etc )?

推荐答案

这是我正在寻找的一个很好的例子:

This is a good example what I was looking for:

https://web.archive.org/web/20111203004656/http:// www.oracleutilities.com/Packages/dbms_alert.html

它显示了一个java应用程序如何使用DBMS_ALERT与Oracle数据库一起工作。

It shows how a java application can work with an Oracle database using DBMS_ALERT.

其他一些有用的链接供参考:

Some other useful links for reference:

http://vapvarun.com/study/oracle/prentice.programming.oracle.triggers .and.stored.procedures.3rd.edition.ebook-lib / 0130850330_ch11lev1sec21.html

http://www.morganslibrary.org/reference/pkgs/dbms_alert.html

http:/ /asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1101233460502

这篇关于Oracle数据库:DBMS_ALERT用法与java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆