You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kannan Ekanath <ka...@gmail.com> on 2007/06/15 08:02:17 UTC

Unable to execute a command mysql with a < symbol

Hi,
ANT - 1.6.5
I am trying to execute the following command line from ANT
"D:\>mysql -u root -pwelcome --database=warranty < target/create-schema.sql"

Basically the create-schema sql file has to be loaded using mysql command. I
understand that there is a problem with "<" symbol in ant command line as
mentioned in http://ant.apache.org/faq.html#shell-redirect-1, Hence I tried,

<target name="execute.schema.script.cmd">
        <echo message="Executing schema script..." />
        <exec executable="mysql">
            <arg line="--user=root --password=welcome --database=wararnty
&lt; target/create-schema.sql" />
        </exec>
</target>

This dint do the job and gave me mysql usage information. Then I tried the
"-c" option that is specified in the link (Guess this is available only with
SHELL?)
<target name="execute.schema.script.cmd">
        <echo message="Executing schema script..." />
        <exec executable="mysql">
            <arg line='-c "--user=root --password=welcome
--database=wararnty &lt; target/create-schema.sql"' />
        </exec>
</target>

This gave me a mysql unknown option "-c".

Presently I am using <SQL> tag to actually create the schema, this being
JDBC indirectly takes a lot of time. I would like to reduce it. Any
suggestions?
-- 
Regards,
Kannan Ekanath

Re: Unable to execute a command mysql with a < symbol

Posted by Kannan Ekanath <ka...@gmail.com>.
I used something like below,

<target name="execute.schema.script">
        <echo message="Executing schema script..." />
        <exec executable="mysql">
            <arg line="--user=root --password=welcome --database=${
jdbc.database}" />
            <redirector input="target/create-schema.sql"></redirector>
        </exec>
    </target>

This seems to work fine.

Thanks,
Kannan

Re: Unable to execute a command mysql with a < symbol

Posted by Steve Loughran <st...@apache.org>.
Kannan Ekanath wrote:
> Hi,
> ANT - 1.6.5
> I am trying to execute the following command line from ANT
> "D:\>mysql -u root -pwelcome --database=warranty < 
> target/create-schema.sql"
> 
> Basically the create-schema sql file has to be loaded using mysql 
> command. I
> understand that there is a problem with "<" symbol in ant command line as
> mentioned in http://ant.apache.org/faq.html#shell-redirect-1, Hence I 
> tried,
> 
> <target name="execute.schema.script.cmd">
>        <echo message="Executing schema script..." />
>        <exec executable="mysql">
>            <arg line="--user=root --password=welcome --database=wararnty
> &lt; target/create-schema.sql" />
>        </exec>
> </target>
> 
> This dint do the job and gave me mysql usage information. Then I tried the
> "-c" option that is specified in the link (Guess this is available only 
> with
> SHELL?)
> <target name="execute.schema.script.cmd">
>        <echo message="Executing schema script..." />
>        <exec executable="mysql">
>            <arg line='-c "--user=root --password=welcome
> --database=wararnty &lt; target/create-schema.sql"' />
>        </exec>
> </target>
> 
> This gave me a mysql unknown option "-c".
> 

I think there is some confusion here.

1. Redirects are a shell function. You cannot exec anything other than 
bash, csh, zsh, tcsh or cmd.exe and expect them to understand redirects.

2. the faq example explicitly shows how to run a shell, because that is 
exactly what you should be doing.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Unable to execute a command mysql with a < symbol

Posted by Chris Velevitch <ch...@gmail.com>.
Can't you just specify the filename without redirection? Is there a
commandline option to specific the sql to execute? If not. look at the
exec tasks I/O redirector.

On 6/15/07, Kannan Ekanath <ka...@gmail.com> wrote:
> Hi,
> ANT - 1.6.5
> I am trying to execute the following command line from ANT
> "D:\>mysql -u root -pwelcome --database=warranty < target/create-schema.sql"
>
> Basically the create-schema sql file has to be loaded using mysql command. I
> understand that there is a problem with "<" symbol in ant command line as
> mentioned in http://ant.apache.org/faq.html#shell-redirect-1, Hence I tried,
>
> <target name="execute.schema.script.cmd">
>         <echo message="Executing schema script..." />
>         <exec executable="mysql">
>             <arg line="--user=root --password=welcome --database=wararnty
> &lt; target/create-schema.sql" />
>         </exec>
> </target>
>
> This dint do the job and gave me mysql usage information. Then I tried the
> "-c" option that is specified in the link (Guess this is available only with
> SHELL?)
> <target name="execute.schema.script.cmd">
>         <echo message="Executing schema script..." />
>         <exec executable="mysql">
>             <arg line='-c "--user=root --password=welcome
> --database=wararnty &lt; target/create-schema.sql"' />
>         </exec>
> </target>
>
> This gave me a mysql unknown option "-c".
>
> Presently I am using <SQL> tag to actually create the schema, this being
> JDBC indirectly takes a lot of time. I would like to reduce it. Any
> suggestions?
> --
> Regards,
> Kannan Ekanath
>


-- 
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
m: 0415 469 095
www.flashdev.org.au

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org