File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes event propagation from database to app server java component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "event propagation from database to app server java component" Watch "event propagation from database to app server java component" New topic
Author

event propagation from database to app server java component

Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
All,

I wanted to check some good ways to achieve this.

We have some core java functionality sitting on the application server. This needs to be called from an Oracle database table event (through Oracle triggers for example).
What is the best way to achieve this

1) Asynchronous call to the java web service on the app server from the Oracle table trigger
2) JMS messaging
3) Java app having a polling service to monitor the database table at regular intervals
4) Scheduler functionality like Quartz
5) any other practice for reverse direction functionality calling.


Regards,
Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
can some one provide tips on how to go about this.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3435
    
  47

I'd suggest to move the functionality to the database. You can create Java stored procedures in Oracle from 9i on, so you don't need to recode the functionality in PL/SQL.

Other possibility would be to use Database Change Notification, available in Oracle 10 and higher (Oracle 11 has some enhancements). You'll need compatible JDBC client though. This will call your Java procedure sitting on application server whenever a monitored table changes, and is usable with connection pools. However it is only suitable when the changes are infrequent, for heavily modified data this is not usable. This functionality is generally meant to allow caching data in the middle tier. When applicable, it is a good alternative to polling.

We successfully use these two techniques in our project. Messaging (Advanced Queuing in Oracle parlance) is certainly another option, though I have no experience with it.

I'd strongly discourage you from using triggers. Your database performace will suffer badly if you try it. (The Database Change Notification - DCN - mentioned earlier is asynchronous, therefore its impact on performance is not that strong.) Moreover, it's really tricky to get triggers right. The transaction that fired the trigger could be rolled back. If you call extenal code, you must make sure to rollback effects of these calls too. By contrast DCN informs you only about changes that were actually comited to the database.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: event propagation from database to app server java component
 
Similar Threads
Reports using Oracle
To the author: Focus of the book
Dealing with locks with JDBC
Problem in connecting to oracle 8i from java application
XML Publisher has bad performance with > 10 concurrent users.