wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes calling trigger from java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "calling trigger from java program" Watch "calling trigger from java program" New topic
Author

calling trigger from java program

nikhil jai
Greenhorn

Joined: Aug 07, 2008
Posts: 9
Hi guyz ,
is there any way by which a trigger can interact with JDBC ?
I want to check the database each time its updated and if some condition is violated , the info((row from table which has voilated some rule) is passed to java code which can then take necessary action . Can anyone help me out in this because i am not aware of any way by which a trigger can interact with java code .
Regards,
Nikhi
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Hi Nikhi,

Welcome to JavaRanch.

is there any way by which a trigger can interact with JDBC ?

Generally, we don't trigger the triggers(database) directly.They get called automatically by database when some operations like insert,update,delete occurs. More about trigger

I want to check the database each time its updated and if some condition is violated
There are many ways you can validate the data.

1)You can put constraints in database itself
2)You can validate the user/file input in your java code too.

Does it help you?
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
One more thing,

You should adhere JavaRanch Naming policy.(I couldn't find the link)
[ August 07, 2008: Message edited by: Vishal Pandya ]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19683
    
  20

Naming policy


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
nikhil jai
Greenhorn

Joined: Aug 07, 2008
Posts: 9
Hii Vishal , thanks for your reply .But i think you didn't get my point ,actually my title is misleading .
I don't want to call trigger from anywhere .They will keep operating on the database . But what i want is as soon as some condition is violated (ie when the updated value of one of the column exceeds the limit) , i need to call the java program and need to pass that particular row to java .My java program will then take the control and take some necessary actions .
Can you help me out in this ??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
"niks",

please don't ignore Rob's post about the naming policy. Accounts without a proper screen name are generally closed.


Ping & DNS - my free Android networking tools app
 
Don't get me started about those stupid light bulbs.
 
subject: calling trigger from java program