Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.io.IOException: Cannot run program "mysql":CreateProcess error=2, The system cannot find the fi

 
Nasoro Salum
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you my friends?

Something is going wrong with my program for database recovery, this error hides my happiness:
java.io.IOException: Cannot run program "mysql":CreateProcess error=2, The system cannot find the file specified

file to be recovered is located in D:/Backup/backup.sql when I browse and open the file from this path then error appears when I I click recovery button. Please help me to solve this problem.
below is my code with JFileChooser for browsing file location.

 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your exec call is attempting to launch mysql.
It will look for that in your PATH.
Is it registered there?

If not you will need to use the full path to the executable...that's the file it can't find, not the backup sql file.
 
Nasoro Salum
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Your exec call is attempting to launch mysql.
It will look for that in your PATH.
Is it registered there?

If not you will need to use the full path to the executable...that's the file it can't find, not the backup sql file.


I would like to know how can I add that full path to the executable, because I use mysql and I added something as it can be seen now but still that error occurs:

 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That execute call is trying to make a call to the underlying OS (Windows in your case, at a guess).
It's a little like typing a command on the command line (though read through this article, as there are common traps people fall into when using it).

Anyway, that aside, what is it exactly you are trying to do?

It looks like you are trying to launch mysql to create a database froma backup?
Is that correct?
 
Nasoro Salum
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:That execute call is trying to make a call to the underlying OS (Windows in your case, at a guess).
It's a little like typing a command on the command line (though read through this article, as there are common traps people fall into when using it).

Anyway, that aside, what is it exactly you are trying to do?

It looks like you are trying to launch mysql to create a database from a backup?
Is that correct?


Yes, I want to create a database from a backup(backup recovery).
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is the command to do that from the command line?

That is what you need to recreate in your exec call.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic