Oracle表更改监视器 [英] Oracle table change monitor

查看:155
本文介绍了Oracle表更改监视器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到远程Oracle数据库视图的java应用程序。

I have a java application that is connected to a view on a remote Oracle db.

有没有人知道用Java监控此表的变化方式?即如果有更新插入等我需要做出反应。

Does anyone know of a way in Java to monitor this table for changes? I.e. if there are inserts of updates etc I would need to react.

推荐答案

你可以在上面放置一个INSERT / UPDATE / DELETE触发器当对表进行数据更改时执行某些操作的表。 (与表格结构的变化相反)

You can place a INSERT/UPDATE/DELETE trigger on the table to perform some action when 'data' changes are made to the table. (as opposed to changes to the structure of the table)

我认为10g还支持视图触发器。

I believe 10g also supports triggers on views.

但是我不确定你怎么能通过民意调查这个其他人的java进程。

but I'm not sure how you can notifiy the java process of this other then by polling.

抱歉。

你可以创建一些解决方案,其中java应用程序有一个'listen'服务器,数据库将它推回一个消息。但这听起来很难维持。

you could possibly create some solution where the java app has a 'listen' server and the database pushes it back a message. but that sounds hard to maintain.

评论中的Justin Cave 建议您可以配置Oracle Streams以发送Java应用程序可以通过JMS订阅的逻辑更改记录(LCR)。或者触发器可以将记录写入Java可以通过JMS订阅的高级队列。

Justin Cave in the comments suggests you could configure Oracle Streams to send out logical change records (LCRs) that a Java app could subscribe to via JMS. Or the trigger could write records to an Advanced Queue that Java could subscribe to via JMS.

您仍然需要警惕Oracle转换..
到期对于Oracle事务的工作方式,触发器将触发更改,但它也可能触发多次..

you will still need to be wary of Oracle transations.. due to the way Oracle transactions work, the trigger will fire on the change, but it may also fire multiple times..

并且在任何情况下java应用程序都无法启动看到更改,直到执行提交。

and in anycase the java app would not bee able to 'see' the changes until a commit had been performed.

这篇关于Oracle表更改监视器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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