Hello Naresh,

this would be a question for the user list, not the development list.
You should try to remove "DELIMITER |" and "|DELIMITER" from your script and retry. I do not know MYSQL but I guess that this syntax could be valid in the MYSQL sql prompt, but not in JDBC.

Regards,

Antoine

naresh123 wrote:
Hi All,


       I am Writing automated Build script for running DBScript using ant .I
am Using ant apache-ant-1.7.1 and  MYSQL5.1 .I  wrote a target for running
the Triggers on the tables like this

    <target name="db-Insert" depends="db-init-dmp">
        <echo message=" Creating the tables for DMP it will fail if the
table already exist" />
        <sql driver="${db.driver}"
             url="${db.url}"
             userid="${db.username}"
             password="${db.password}" >
        
                <transaction src="XXX.sql" />
        </sql>
</target>
XXX.sql is the Script for creating the  Triggers

My sql Triggers looks like this


 DELIMITER |

  CREATE TRIGGER inserttree AFTER INSERT ON XXXXX

  FOR EACH ROW
  BEGIN

   DECLARE s INTEGER;
    DECLARE t INTEGER;
       DECLARE ParentPath varchar(30);

   SET s=NEW.REPORTS_TO;
   SET t = NEW.ID;

  if s is NULL then
 insert into hierarchy_path values (t,t);
    else
     select PATH INTO  ParentPath from hierarchy_path where ID = s;
  insert into hierarchy_path values (t,CONCAT(ParentPath,',',t));

    end if;
    END;
 |
    DELIMITER

when ant executing this code its giving error at line 1 like
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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' at line 1

Can any body Pls help me



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to