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.
SQL=""; SQL="DELIMITER $$ "+ "DROP TRIGGER `a1`.`xData` || "+ "CREATE TRIGGER `a1`.`xData` AFTER UPDATE ON `a1`.`tinfo`" + "FOR EACH ROW BEGIN " + "IF (OLD.Name <> NEW.Name) THEN " + "INSERT INTO tlog (remark) VALUES ('EditData'); " + "END IF; " + "END;" + "$$" + "DELIMITER;"; stmt=con.createStatement(); rs=stmt.execute(SQL);
I am having the same problem as well. There doesnt seem to be a lot of stuff on the internet regarding "triggers from Java"