I have a java application that is connected to a view on a remote Oracle db.
Does anyone know of a way in Java to monitor this table for changes? I.e. if there are inserts of updates etc I would need to react.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can place a INSERT/UPDATE/DELETE trigger on the table to perform some action when ‘data’ changes are made to the table. (as opposed to changes to the structure of the table)
I believe 10g also supports triggers on views.
but I’m not sure how you can notifiy the java process of this other then by polling.
sorry.
you could possibly create some solution where the java app has a ‘listen’ server and the database pushes it back a message. but that sounds hard to maintain.
Justin Cave in the comments suggests you could configure Oracle Streams to send out logical change records (LCRs) that a Java app could subscribe to via JMS. Or the trigger could write records to an Advanced Queue that Java could subscribe to via JMS.
you will still need to be wary of Oracle transations.. due to the way Oracle transactions work, the trigger will fire on the change, but it may also fire multiple times..
and in anycase the java app would not bee able to ‘see’ the changes until a commit had been performed.