I am trying whole evening in this sunday to make this one:
<exec executable="osql.exe" dir="${basedir}" failonerror="true">
<arg value="-U<user>" />
<arg value="-P<password>" />
<arg value="-S<server>" />
<arg value="-QRESTORE DATABASE <database> FROM DISK='<absolute_path_to_database_backup>.bak'" />
<arg value="-b" />
</exec>
As suspected, the
<arg line=""/>
also do not work. :(
into the same call, only using sqlcmd utility. Unforutinetly all I can get is the error message from ants executed sqlcmd that there is "Unexepcted attribute. Consult help -?".
[exec] Sqlcmd: '-Q"RESTORE DATABASE <database> FROM DISK='<absolute_path_to_database_backup>.bak'"': Unexpected argument. Enter '-?' for help.
BUILD FAILED C:\SVN\Ver_trunk\Upgrade\build.xml:72: exec returned: 1
Actual names are replaced with <> brackes.
My PC software configuration:
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Any help highly appreciated to make the correct syntax for this sqlcmd ... :)
Okay, here is the summary of the things I had to do to make it work ( at least from Jenkins :( ):
<arg line="" />
syntax, not <arg value="" />