I'm using oracle.jdbc.dcn.DatabaseChangeEvent in order to get events notifications from my Oracle DB:
public class TListener implements DatabaseChangeListener
{
...
public void onDatabaseChangeNotification(DatabaseChangeEvent e)
{
....
synchronized( changeNotification ){
changeNotification.notify();
}
}
}
And in Another place:
private void run(PropertiesConfiguration configuration) throws SQLException
{
OracleConnection conn = connect(configuration);
Properties prop = new Properties();
prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS,"true");
prop.setProperty(OracleConnection.DCN_QUERY_CHANGE_NOTIFICATION,"true");
DatabaseChangeRegistration dcr = conn.registerDatabaseChangeNotification(prop);
try
{
// add the listenerr:
TListener list = new TListener(this);
dcr.addListener(list);
// second step: add objects in the registration:
Statement stmt = conn.createStatement();
// associate the statement with the registration:
((OracleStatement)stmt).setDatabaseChangeRegistration(dcr);
ResultSet rs = stmt.executeQuery("select * from GTW_TX");
while (rs.next()){}
rs.close();
stmt. Close ();
}
My question: Is there a way to know which exactly rows where inserted\updated\changed\dalteted?
My purpose is to monitor the DB and do some actions when some specific events occurs, so I want to be able to know the new\updated row values in order to notify the Monitoring system (And to avoid full table scan with every event).
Important note: I do not have access to the DB beside the ability to "select", so triggers are not possible here.
Thank you.