This discussion is archived
6 Replies Latest reply: Oct 18, 2012 8:50 AM by Jan Nawara RSS

Oracle DCN unregisteration when using RAC and JDBC driver

andy dufresne Newbie
Currently Being Moderated
While unregistering a database change notification (DCN) by calling the method
     void unregisterDatabaseChangeNotification(DatabaseChangeRegistration registration)

we encounter an error with the message - java.sql.SQLException: an attempt was made to delete a registration that is using a different database instance than the one currently connected to.

The error is because the jdbc driver has the below code in oracle.jdbc.driver.PhysicalConnection class
public void unregisterDatabaseChangeNotification(DatabaseChangeRegistration paramDatabaseChangeRegistration) throws SQLException {
    NTFDCNRegistration localNTFDCNRegistration = (NTFDCNRegistration)paramDatabaseChangeRegistration;
    if (localNTFDCNRegistration.getDatabaseName().compareToIgnoreCase(this.instanceName) != 0)
    {
      SQLException localSQLException = DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 245);

      localSQLException.fillInStackTrace();
      throw localSQLException;
    }

    doUnregisterDatabaseChangeNotification(localNTFDCNRegistration);
}
Here the implementation checks if the instance name in the connection using which the unregistration method call is made matches with the one which was used when the registration method was called.

I did not understand why does the jdbc driver impose the restriction that the unregistration should be done on the same oracle instance where the registration was made. Anyone?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points