0

I did oracle CQN registration from Java application using JDBC driver with the following parameters

      Properties prop = new Properties();
        prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS, "true");
        prop.setProperty(OracleConnection.NTF_QOS_RELIABLE, "true");
        prop.setProperty(OracleConnection.DCN_CLIENT_INIT_CONNECTION, "true");

 try (OracleConnection connection = (OracleConnection) DriverManager.getConnection(jdbcUrl, dbUsername, dbPassword)) {

            DatabaseChangeRegistration dcr = ((OracleConnection) connection).registerDatabaseChangeNotification(prop);

            dcr.addListener(this);

            OracleStatement stmt = (OracleStatement) connection.createStatement();
            stmt.setDatabaseChangeRegistration(dcr);
            ResultSet rs = stmt.executeQuery("select * from employees");
...

Oracle Database every time registers a new registration Id and callback, is there any way to use existing one? I want to get all the notifications in case of my application restart.

Bera
  • 673
  • 2
  • 12
  • 31
  • Can you explain your use case in more details? A registration can be used as a singleton per JVM and multiple statements from multiple connections can be associated with it. But you indicated an application restart. Is that your Java application? If so, your registration will be gone, and you will need to register again. – Jean de Lavarene Mar 25 '23 at 09:54
  • I mean single application with the single object I am waiting for notifications. I want to get all the changes includes when my java application restarts – Bera Mar 25 '23 at 10:35
  • When your app restarts your cache has been flushed, and you can get the latest version from the DB, so would you need to be notified? – Jean de Lavarene Mar 27 '23 at 06:36
  • I want to get all the changes, so I want to get all the notifications generated during my application restart. – Bera Mar 27 '23 at 09:58

0 Answers0