Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以从数据库向Spring应用程序发送插入通知?_Spring_Database_Oracle_Notifications - Fatal编程技术网

是否可以从数据库向Spring应用程序发送插入通知?

是否可以从数据库向Spring应用程序发送插入通知?,spring,database,oracle,notifications,Spring,Database,Oracle,Notifications,在检测到Oracle数据库表中插入了一行之后,我目前正在尝试在我的spring应用程序中触发一个事件。由于对数据库和PL/SQL的知识有限,我正在努力寻找最佳方法。 注意:该表中的插入发生在另一个软件中,这意味着我无法在正在使用的应用程序中管理它。如果您使用的是Oracle,则可以使用DatabaseChangeListener 像这样的 public class DBListener implements DatabaseChangeListener { private DbChang

在检测到Oracle数据库表中插入了一行之后,我目前正在尝试在我的spring应用程序中触发一个事件。由于对数据库和PL/SQL的知识有限,我正在努力寻找最佳方法。
注意:该表中的插入发生在另一个软件中,这意味着我无法在正在使用的应用程序中管理它。

如果您使用的是Oracle,则可以使用
DatabaseChangeListener

像这样的

public class DBListener implements DatabaseChangeListener {
    private DbChangeNotification toNotify;

    public BNSDBListener(DbChangeNotification toNotify) {
        this.toNotify = toNotify;
    }

    @Override
    public void onDatabaseChangeNotification(oracle.jdbc.dcn.DatabaseChangeEvent e) {
        synchronized( toNotify ) {
            try {
                toNotify.notifyDBChangeEvent(e); 
            } catch (Exception ex) {
                Util.logMessage(CLASSNAME, "onDatabaseChangeNotification", 
                    "Errors on the notifying object.", true);
                Util.printStackTrace(ex);
                Util.systemExit();                                       
            }
        }       
    }
}

更多信息

谢谢你提供的信息,我会看看什么适合我的情况