IOException

Hi , I got this error for the following code:

java.io.IOException: java.io.IOException: mysqldump --xml -u root -p formiga form: not found

String cmd [] = {"mysqldump --xml -u root -p formiga form","" };

Process p = Runtime.getRuntime().exec(cmd);

p.waitFor();

Could anyone please help me?

Thanks

Camila

[352 byte] By [Camilaa] at [2007-11-27 6:04:30]
# 1
As a guess I think mysqldump is a command a shell will only recognise and you need to call the shell first.
_helloWorld_a at 2007-7-12 16:48:39 > top of Java-index,Java Essentials,Java Programming...
# 2

> String cmd [] = {"mysqldump --xml -u root -p formiga

1) Read API for IOException

2) Double check your mysqldump statement. I imagine this is the source of your trouble.

You can't put spaces between the flags and their values, at least not for password (-p).

Your statement should read "mysqldump -uroot -pformiga..." and so on.

cimmerian76a at 2007-7-12 16:48:39 > top of Java-index,Java Essentials,Java Programming...
# 3

Try something like

//windows

String cmd [] = {"cmd", "/c", "mysqldump --xml -u root -p formiga form","" };

//Linux

String cmd [] = {"konsole", "-e", "mysqldump --xml -u root -p formiga form","" };

Maybe someone else has a better idea though.

_helloWorld_a at 2007-7-12 16:48:39 > top of Java-index,Java Essentials,Java Programming...
# 4

I can't speak to calling mysqldump from a java app since I've never done it, but the statement itself is definitely off.

MySql takes '-p formiga' to mean it needs a password (not given) and dump from the database 'formiga'.

It'll prompt for a password from the command line in this form. Then it will throw an error when it can't find the 'formiga' database.

From what I saw of the error the statement should look like

mysqldump --xml -uroot -pformiga form

Of course, if mysql isn't in your command path, it won't work either.

Message was edited by:

cimmerian76

cimmerian76a at 2007-7-12 16:48:39 > top of Java-index,Java Essentials,Java Programming...
# 5
thanks for you all.....I 'll try our advise....
Camilaa at 2007-7-12 16:48:39 > top of Java-index,Java Essentials,Java Programming...