ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <levylamb...@tiscali-dsl.de>
Subject Re: perplexing exec mysql problem
Date Wed, 21 May 2003 21:28:34 GMT
2 tips :
- use ant 1.6alpha (nightly builds) . ant 1.6 has an input attribute for
exec, indicating a file from which standard input is taken,
- even better : try to use the <sql/> task instead of the <exec/> task to
run your DDL or DML scripts.
<sql/> can connect directly to the database (through JDBC driver) and
execute whatever SQL statements you want.
Antoine
----- Original Message -----
From: "M Damon Hill" <hwgwld17@yahoo.com>
To: <user@ant.apache.org>
Sent: Wednesday, May 21, 2003 10:02 PM
Subject: perplexing exec mysql problem


> good day...
>
> I have been working on this now for a couple of hours and can't seem to
see the problem with the code. A little help from some extra eyes would be
very appreciative.
>
> I am trying to create a database in mysql and then execute some sql
scripts on the newly created database. All of this of course done using the
<exec> task. Here is the code for a couple of the targets in the build.xml:
>
>
> <target name="init_db"><!--depends="transform_default_project"-->
>   <exec executable="mysqladmin" output="createDB.output">
>       <arg line="create ${project.db.name}"/>
>   </exec>
>   <antcall target="sql_script_1"/>
> </target>
>
>
>
> <target name="sql_script_1">
>   <exec executable="mysql" output="initDB.output">
>     <arg line="${project.db.name} &lt; ${sql.dir}/${sql1}"/>
>   </exec>
>   <antcall target="sql_script_2"/>
> </target>
>
>
>
> <target name="sql_script_2">
>   <exec executable="mysql" output="initDB.output">
>     <arg line="${project.db.name} &lt; ${sql.dir}/${sql2}"/>
>   </exec>
>   <antcall target="sql_script_3"/>
> </target>
>
> Now as you can tell the script will first use mysqladmin to create the
database. That particular task executes just fine and creates the databse
with no problems. However, whenever I run the second target, in this case
sql_script_1, it does not update the database and the resulting exec returns
a 1.
>
> I can run the same command from the command line on the machine I am
testing this script on and it works properly. The command is:
>        mysql project.db.name < path_to_script/sql1
>
> This works fine like I say from the command line but not from inside ant.
>
> Anyone have any thoughts or suggestions for this?? Seen anything like it
before??
>
> Thanks in advance!
>
> damon
>
>
>
> ---------------------------------
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.


Mime
View raw message