Results 1 to 7 of 7
- 11-11-2008, 12:32 PM #1
Member
- Join Date
- May 2008
- Posts
- 69
- Rep Power
- 0
Restoring database through java application..?
Hi Members,
I have to restore the mysql database through java application. I tried using the code
" Runtime.getRuntime().exec("mysql -u -p databasename < c:/backup.sql");"
But this is restoring the database.
But the same command works fine while running through command line.
Please provide some solutions to this issue.
Regards,
Prabhu.
- 11-11-2008, 01:11 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,568
- Rep Power
- 14
It has to do with either the redirection or the path or both. Read When Runtime.exec() won't - JavaWorld thoroughly and carefully.
- 11-11-2008, 01:38 PM #3
Member
- Join Date
- May 2008
- Posts
- 69
- Rep Power
- 0
Hi Masijade,
Im new to java, however i gone through it, but what i understood is, the process executed should be handled.
However do you have any idea of my problem, what goes wrong in my part.
- 11-11-2008, 01:52 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,568
- Rep Power
- 14
There is no way that you thoroughly read the posted document and evaluated it's advice and suggestions against your code in the time between our posts.
Read that link, and use its advice. And bookmark it.
That link has everything you need (and could even want, except for a block copy and paste solution).
- 11-11-2008, 02:25 PM #5
Member
- Join Date
- May 2008
- Posts
- 69
- Rep Power
- 0
I ran the sample code given in the link provided by you, but my command is not getting executed. Instead it provides the 'usage option' for mysql command.
My head is spinning masijade... Help me to figure out my mistake.
- 11-11-2008, 02:34 PM #6
Member
- Join Date
- May 2008
- Posts
- 69
- Rep Power
- 0
run-main:
USAGE: java GoodWindowsExec <cmd>
osName : Windows XP
Execing cmd.exe /C C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql -u user-p pass database < C:/backup.sql
ERROR>'C:\Program' is not recognized as an internal or external command,
ERROR>operable program or batch file.
ExitValue: 1
When i tried to execute, im facing this issue..............
- 11-11-2008, 03:06 PM #7
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,568
- Rep Power
- 14
Similar Threads
-
deploying Java Desktop application with MySql database
By lyjen in forum New To JavaReplies: 3Last Post: 10-28-2010, 03:42 PM -
Help with Java application to connect to a database
By coco in forum JDBCReplies: 3Last Post: 09-18-2008, 04:07 PM -
Excel to database using java
By Priyadharshini.s in forum Advanced JavaReplies: 1Last Post: 03-08-2008, 07:12 PM -
Java Database Connectivity
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 01-14-2008, 02:11 PM -
PDA, Database, and Java
By percivalwcy in forum CLDC and MIDPReplies: 0Last Post: 08-08-2007, 04:12 AM
Bookmarks