Trouble with mysqldump

when i try
program=“C:\Program Files\MySQL\MySQL Server 5.1\bin
\mysqldump.exe”
irb(main):008:0> system(program)
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3…]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]

it works and is able to launch myssqldump.exe
so i want to setup a backup process using ruby.
however the next step does not work. dont know why?

destination=“e:\tradingtools\databackup\#{dt}.sql”
system("#{program} --user=root --password=password dbtrader

#{destination}")

error that i get is
‘C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

On Sat, Aug 7, 2010 at 11:45 AM, Junkone [email protected] wrote:

destination=“e:\tradingtools\databackup\#{dt}.sql”
system("#{program} --user=root --password=password dbtrader

#{destination}")

error that i get is
‘C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

You’ll need to wrap the program name in quotes to use it with arguments
like
that. Try instead:
system(""#{program}" --user=root --password=password dbtrader >
“#{destination}”")

Ideally you would pass each argument to system as a separate argument,
like:
system(program,"–user=root","–password=password", etc)
But I don’t know how to pipe the output of this to a file… perhaps
someone
else on the list can help.

-Jonathan N.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs