ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: SQL parameter
Date Wed, 18 Feb 2004 18:27:09 GMT
The <sql> task does support running a single sql statement. See the examples in the documentation.

-Rob A

> -----Original Message-----
> From: Mario Manfre [mailto:MarioM@PGAS.com]
> Sent: Wednesday, February 18, 2004 7:54 AM
> To: Ant Users List
> Subject: RE: SQL parameter
> 
> 
> ok..closer but not that I got my &quot 
> 
> If I do
> 
>             <arg value='-q&quot;drop database ${db.name}&quot;'/>
> I get the following
> 'osql'
> '-E'
> '-SSQL-SERVER\MYDBs'
> '-a8192'
> '-q"drop database NightBuild_Test";'
> 
> The ' characters around the executable and arguments are
> not part of the command.
>      [exec] usage: osql              [-U login id]          
> [-P passwor
>      [exec]   [-S server]            [-H hostname]          
> [-E trusted
>      [exec]   [-d use database name] [-l login timeout]     
> [-t query t
>      [exec]   [-h headers]           [-s colseparator]      
> [-w columnw
>      [exec]   [-a packetsize]        [-e echo input]        [-I Enable
>      [exec]   [-L list servers]      [-c cmdend]            
> [-D ODBC DS
>      [exec]   [-q "cmdline query"]   [-Q "cmdline query" and exit]
>      [exec]   [-n remove numbering]  [-m errorlevel]
>      [exec]   [-r msgs to stderr]    [-V severitylevel]
>      [exec]   [-i inputfile]         [-o outputfile]
>      [exec]   [-p print statistics]  [-b On error batch abort]
>      [exec]   [-O use Old ISQL behavior disables the following]
>      [exec]       <EOF> batch processing
>      [exec]       Auto console width scaling
>      [exec]       Wide messages
>      [exec]       default errorlevel is -1 vs 1
>      [exec]   [-? show syntax summary]
> 
> 
> 
> BUILD FAILED
> C:\PGAS\Development\Build\build.xml:615: exec returned: 1
>         at 
> org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.j
>         at 
> org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java
>         at 
> org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java
>         at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.j
>         at org.apache.tools.ant.Task.perform(Task.java:401)
>         at org.apache.tools.ant.Target.execute(Target.java:338)
>         at org.apache.tools.ant.Target.performTasks(Target.java:365)
>         at 
> org.apache.tools.ant.Project.executeTarget(Project.java:1237
>         at 
> org.apache.tools.ant.Project.executeTargets(Project.java:109
>         at org.apache.tools.ant.Main.runBuild(Main.java:669)
>         at org.apache.tools.ant.Main.startAnt(Main.java:220)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
> 
> 
> also, it looks like the <sql command doesn't allow a single 
> SQL command to be issued, only running of a .sql file :(
> 
> -----Original Message-----
> From: Antoine Lévy-Lambert [mailto:antoine@apache.org]
> Sent: Tuesday, 02 17, 2004 16:12
> To: Ant Users List
> Subject: Re: SQL parameter
> 
> 
> Mario Manfre wrote:
> 
> >HI,
> >I'm trying to create or drop a database based on a property file.
> >
> >the basics are
> >
> > <property name="db.name"        value="Test_DB"/>
> >
> >
> >and then either do
> >
> >            <exec  executable="osql"
> >                  dir="C:\Build\"
> >                  failonerror="true"   
> >                  vmlauncher="false"
> >                  >
> >            <arg value='-E'/> 
> >            <arg value='-SSQL-SERVER\MYDBs'/>
> >            <arg value='-q"drop database ${db.name}"'/>
> >            </exec>
> >
> >
> >      <sql driver="${dbDriver}"
> >             classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
> >             url="${jdbc-connect}"
> >             userid="${db.user}"
> >             password="${db.user.password}"
> >             print="false"
> >             >
> >             <transaction src="drop database ${db.name}"/>
> >             </sql>
> >
> >Or is there some other way which I am missing?
> >
> >Thanks,
> >Mario
> >
> >  
> >
> This sounds good. Pay attention that you might need to escape 
> as &quot; 
> the double quotes in the argument -q"drop database ${db.name}",
> so write -q&quot;drop database ${db.name}&quot;
> 
> Come back to the list if something does not work out properly.
> 
> Antoine
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 


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


Mime
View raw message