• Post Reply Bookmark Topic Watch Topic
  • New Topic

invoking a trigger

 
Loh Ying Hui
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone tell me how can i invoke a trigger in a Database from a servlet ? what kind of statement do i need to execute ?
thanks
 
Tina Coleman
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically triggers are set to be invoked when someone inserts, updates, or deletes a row in the database. I don't think that triggers can be executed directly. If you need to do some sort of direct execution, use a stored procedure. Or execute the appropriate SQL from your code.
 
Loh Ying Hui
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh i see. can you tell me what's the difference between createStatement and createPreparedStatement ?
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
createPreparedStatement --> no such method...which leads me to believe you may need to have a read through Sun's
JDBC tutorial for the basic's.
Jamie
 
Loh Ying Hui
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh! I didnt notice i wrote createPreparedStatement instead of preparedstatement. anywayz, thanx for the link!
 
There's a way to do it better - find it. -Edison. A better tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!