0

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 ... :)

Community
  • 1
  • 1
HX_unbanned
  • 583
  • 1
  • 15
  • 51
  • Nop, do not work for me. Same message. :( – HX_unbanned Jun 05 '13 at 07:10
  • Try running ANT in debug mode and see how the exec task is assembing the command to the operating system. – Mark O'Connor Jun 05 '13 at 12:03
  • Thanks, Marc! I did not tried it before just because I really thought it will disassemble it just like it does with osql.exe ... but I was wrong ... :( What I got now is finally something more: "Sqlcmd: Error: Connection failure. SQL Native Client is not installed correctly. To correct this, run SQL Server Setup." :D Atleast it parsed the cmdline fine ... now got to get my W7 with 2008r2 and 2012 version working ... – HX_unbanned Jun 05 '13 at 12:11
  • Interesting though that @ Jenkins ant fails on SQL2005 instance with the following:"Incorrect syntax near 'C:'" ... using task ... weird ... – HX_unbanned Jun 05 '13 at 12:50

1 Answers1

0

Okay, here is the summary of the things I had to do to make it work ( at least from Jenkins :( ):

HX_unbanned
  • 583
  • 1
  • 15
  • 51