Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers calling Java/servlets
In article <3c907bc4_at_news.broadpark.com>, "comp.text.xml" says...
>
>Hi.
>
>Is it possible to set up a trigger in Oracle than calls a Java Servlet
>residing on a web server? I have a web application that needs to be notified
>when a table changes in the DB.
>
>-Christer
>
>
Well, you can use UTL_HTTP to run a URL. A perhaps better approach however might be to use AQ to queue a message and have the java process be the dequeuer of the message. That would be transactional and a little more "fault resistant" (well, alot more actually).
The problem with utl_http is
o the trigger might run the URL and then the statement later fails (hence the trigger should NOT have run the URL but you cannot "unrun" it)
o there is overhead in opening the external connection, running the servlet, closing the connection. More then queueing a message would be.
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Thu Mar 14 2002 - 10:02:22 CST