Database Change Notification Registration returning wrong table name
766150Apr 12 2010 — edited Mar 23 2011Hello,
I have a java package where I am attempting to implement a database Change notification registration and listener. I can create a registration but my listener fails to notify the operating thread when a change occurs on the registered table. For my example, I can successfully register a change notification on a table named "<user>.CUSTOM_TESTER". When I call getTables() from my registration object, it returns: "<user>.CUSTOM" omitting the rest of the table name following the underscore. I can only assume that the listener is awaiting changes on a table that does not exist. Is this a bug? Is there some implementation detail I am ommitting here? The following code implements the issue I have just described:
OracleConnection conn4 = dbConnect(dbURL, dbUser, dbPwd);
Properties prop = new Properties();
prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS,"true");
prop.setProperty(OracleConnection.DCN_QUERY_CHANGE_NOTIFICATION,"true");
DatabaseChangeRegistration dcr = conn4.registerDatabaseChangeNotification(prop);
try{
// add the listener:
DCNListener list = new DCNListener(this);
dcr.addListener(list);
// second step: add objects in the registration:
Statement stmt = conn4.createStatement();
// associate the statement with the registration:
((OracleStatement)stmt).setDatabaseChangeRegistration(dcr);
ResultSet rs = stmt.executeQuery("select phone_num from custom_tester where phone_num = '5551239876'");
rs.next();
String[] tableNames = dcr.getTables(); // wrong table named returned here
for(int i=0;i<tableNames.length;i++) //escape the increment chars so everything else isn't italicized?
System.out.println(tableNames[i]+" is part of the registration."); // wrong table named returned here
rs.close();
stmt.close();
}
catch(SQLException ex) . . .
Edited by: user9525115 on Apr 12, 2010 10:24 AM