Create trigger mysql5 with java

Reply

Join Date: Apr 2007
Posts: 34
Reputation: onsir is an unknown quantity at this point 
Solved Threads: 1
onsir onsir is offline Offline
Light Poster

Create trigger mysql5 with java

 
0
  #1
Sep 3rd, 2007
Hi,
how to create trigger in mysql 5 with java.
i have code like this, but still error "
java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$ CREATE TRIGGER `a1`.`xData` AFTER UPDATE ON `a1`.`tinfo`IF (' at line 1 "
thanks.


  1. SQL="";
  2. SQL="DELIMITER $$ "+
  3. "DROP TRIGGER `a1`.`xData` || "+
  4. "CREATE TRIGGER `a1`.`xData` AFTER UPDATE ON `a1`.`tinfo`" +
  5. "FOR EACH ROW BEGIN " +
  6. "IF (OLD.Name <> NEW.Name) THEN " +
  7. "INSERT INTO tlog (remark) VALUES ('EditData'); " +
  8. "END IF; " +
  9. "END;" +
  10. "$$" +
  11. "DELIMITER;";
  12. stmt=con.createStatement();
  13. rs=stmt.execute(SQL);
Last edited by onsir; Sep 3rd, 2007 at 5:15 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC