Two Laptop Bag*
The moose likes JDBC and the fly likes Need to call a Java Object / Servlet from a Trigger Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Need to call a Java Object / Servlet from a Trigger" Watch "Need to call a Java Object / Servlet from a Trigger" New topic
Author

Need to call a Java Object / Servlet from a Trigger

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi could anyone please help me on this issue .

We are using Oracle 10g as our DataBase .

Is it possile to write a Trigger in such a way that whenever there is a chnage in Database (insert/update) We need to call a Servlet/Or any Java Program

Any link will be a great help .

Thanks in advance .


Save India From Corruption - Anna Hazare.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Oracle does let you Java-based stored procedures into the system, but its been awhile since I've done it.


My Blog: Down Home Country Coding with Scott Selikoff
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
Here you find java stored trigger sample:
http://www.oracle.com/technology/sample_code/tech/java/jsp/oracle9ijsp.html

I am not sure if calling servlet from the triger at each insert/update is a good idea, that could cause performance problems.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

Thanks for the replies when i tried with this syntax :


// I had created a servlet and placed it in my server .

At first

When i created this trigger in Oracle it displayed as
Warning: Trigger created with compilation errors.

and when i inserted some sample values in the dept table in database .

ORA-04098: trigger 'SCOTT.LAD' is invalid and failed re-validation


Any ideas .
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Show errors will help work out what is wrong.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need to call a Java Object / Servlet from a Trigger