eggmatters 21 Junior Poster in Training

I posted this on Oracle Forums to the sound of crickets chirping. This question entails more Oracle specific tasks then java but since my code is in java, here goes"

Hello,

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++) 
System.out.println(tableNames+" is part of the registration."); 

rs.close();
stmt.close();
}
catch(SQLException ex) . . .

More code is available but is essentially adopted from here:
http://www.filibeto.org/sun/lib/nonsun/oracle/11.1.0.6.0/B28359_01/java.111/b31224/dbmgmnt.htm

with very little change. I tried calling other tables, with far spookier results. The table name just isn't being parsed properly. Sounds like a bug with the jdbc drivers to me. Anyone with similar experiences?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.