This discussion is archived
4 Replies Latest reply: Jan 22, 2013 8:52 AM by rp0428 RSS

Database Change Notification API : getTableName() always returns "???"

914918 Newbie
Currently Being Moderated
Dear colleagues,
I am trying to set up database change notification listener according to example in docs.

Code snippet :

OracleConnection conn = (OracleConnection) dataSource.getConnection() ;

*// properties are : OracleConnection.DCN_QUERY_CHANGE_NOTIFICATION=false , OracleConnection.DCN_NOTIFY_ROWIDS=true*
databaseChangeRegistration = conn.registerDatabaseChangeNotification(dcnProperties);

databaseChangeRegistration.addListener(this) ;

*// add objects*
OracleStatement statement = (OracleStatement) conn.createStatement();
statement.setDatabaseChangeRegistration(databaseChangeRegistration);
*for (String tableName : tableNames) {*
     *// use dummy query to add the table:*
statement.executeQuery("select ROWID from " + tableName + " where 1=0");
*}*
               
log.info("Registered database change notification for tables:" + StringUtils.join(databaseChangeRegistration.getTables(),","));


It seems a bit weird to me that registering a table for notification requires sending a dummy query to that table. But I have found nothing better in docs or anywhere else.
Nevertheless, logger shows the expected set of tables at last line.
However when I get the actual event of type OBJCHANGE , tableChangeDescription.getTableName() always has value of "???". Other fields of the object are well populated (rowId, operation etc.)
Please help to get actual table name(s) in events. Many thanks in advance !
  • 1. Re: Database Change Notification API : getTableName() always returns "???"
    986111 Newbie
    Currently Being Moderated
    I have the same issue.

    Has someone a solution yet?

    Kind regards.
  • 2. Re: Database Change Notification API : getTableName() always returns "???"
    rp0428 Guru
    Currently Being Moderated
    >
    I have the same issue.
    >
    Then create your own thread and provide the particulars about your environment and problem: 4 digit Oracle version, jdbc jar file name and version, Java version.

    Your problem may be similar to OPs but the particulars and solution are likely to be different so you need your own thread; especially since this thread is a year old and is likely abandoned.
  • 3. Re: Database Change Notification API : getTableName() always returns "???"
    986111 Newbie
    Currently Being Moderated
    I do not see the benefit to create a new thread for exactly the same problem.
    That would just duplicate the issue.
    You found this thread as well.

    Anyway you are right some additional informations are missing:
    I use ojdbc6.jar in Version 11.2.0.3.0.
    My Database is Oracle 11g.

    Everything works as intended. Just the table information is missing.

    Did I miss something important?
  • 4. Re: Database Change Notification API : getTableName() always returns "???"
    rp0428 Guru
    Currently Being Moderated
    HIJACKED THREAD!

    Do NOT hijack another user's thread for your own questions.
    >
    Did I miss something important?
    >
    Yes - the need to create your own thread!
    >
    I do not see the benefit to create a new thread for exactly the same problem.
    That would just duplicate the issue.
    >
    The primary benefit is that it promotes efficient use of the forums to help people with their problems.

    It makes it easier for forum volunteers to focus on the OPs problem without getting sidetracked onto other variations that are not going to benefit OP or the general forum audience.

    When someone asks a question on the forum it is analogous to standing up at a podium in front of an audience and asking for help with a particular problem.

    When you HIJACK another user's thread it ie analogous to you standing up in the audience and drowning out the help being provided by shouting out your own question.

    Your particulars (db/jdbc/java versions) are likely to be different than OPs. Posting multple sets of version and use case information clutters the forum and makes it difficult to follow.

    It is just as easy for you to create your own thread as it is to HIJACK someone elses so please do it. If you want to provide a link to this thread for reference then do that.

Legend

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