use of org.jabref.shared.listener.OracleNotificationListener in project jabref by JabRef.
the class OracleProcessor method startNotificationListener.
@Override
public void startNotificationListener(DBMSSynchronizer dbmsSynchronizer) {
this.listener = new OracleNotificationListener(dbmsSynchronizer);
try {
oracleConnection = (OracleConnection) connection;
Properties properties = new Properties();
properties.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS, "true");
properties.setProperty(OracleConnection.DCN_QUERY_CHANGE_NOTIFICATION, "true");
databaseChangeRegistration = oracleConnection.registerDatabaseChangeNotification(properties);
databaseChangeRegistration.addListener(listener);
try (Statement statement = oracleConnection.createStatement()) {
((OracleStatement) statement).setDatabaseChangeRegistration(databaseChangeRegistration);
StringBuilder selectQuery = new StringBuilder().append("SELECT 1 FROM ").append(escape("ENTRY")).append(", ").append(escape("METADATA"));
// this execution registers all tables mentioned in selectQuery
statement.executeQuery(selectQuery.toString());
}
} catch (SQLException e) {
LOGGER.error("SQL Error: ", e);
}
}
Aggregations