what is trigger ?

hi, good day, what is trigger and how it can implement under java coding ? when we should use it ? thank you
[115 byte] By [alvincksa] at [2007-10-2 5:22:22]
# 1
triggers run in databases that support them, not java.they're bits of SQL code that run in a database when a certain event occurs (e.g., before insert on a table).%
duffymoa at 2007-7-16 1:24:17 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Triggers are procedures that get executed on certain database events. Not all databases support procedures, not all databases that support procedures also support triggers, and the types of events that are supported also vary from database to database.

Trigger procedures can be implemented in the procedural language(s) supported by the particular database; a few databases support Java as a procedural language, but most do not. The only product I know of that supports Java-based triggers is Oracle; I know the feature was available in Oracle 9i but I don't know if goes back to older versions. Here's a link to sample code for an Oracle Java-based trigger (free registration required):

http://www.oracle.com/technology/sample_code/tech/java/jsp/oracle9ijsp.html

(about the 6th example in the list).

You use triggers when you want a normal operation to have a side-effect; what that side-effect can be is only limited to the capabilities of the procedural language and your skill in it. You could for example have a trigger send email every time the data in a particular table is changed.

StuDerbya at 2007-7-16 1:24:17 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Im interesting exactly for the last example (to send an e-mail when the data is change) how to do this im searching but i can't find an example or something .Thanks
pakfaka at 2007-7-16 1:24:17 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
http://asktom.oracle.com/pls/ask/f?p=4950:8:16651252967825754202::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:2391265038428
StuDerbya at 2007-7-16 1:24:17 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...