2

我们希望在多集群环境中实现 Oracle 数据库连续查询通知。但是我们希望数据库更改通知应该只发送到应用程序的一个实例,因为到目前为止它会将更改通知发送到所有实例。我如何获得所需的特性。我的听众代码是

 DCNDemoListener list = new DCNDemoListener(this);
            dcr.addListener(list);

            // second step: add objects in the registration:
            Statement stmt = conn.createStatement();
            // associate the statement with the registration:
            ((OracleStatement)stmt).setDatabaseChangeRegistration(dcr);
            ResultSet rs = stmt.executeQuery("select * from testtable where ID=1");

特性 :

OracleConnection conn = connect();

        // first step: create a registration on the server:
        Properties prop = new Properties();
        prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS,"true");
        prop.setProperty(OracleConnection.DCN_QUERY_CHANGE_NOTIFICATION,"true");
        DatabaseChangeRegistration dcr = conn.registerDatabaseChangeNotification(prop);
4

0 回答 0