Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke mysql backup command in java ? (mysqldump)

 
kit james
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need desperately the code that will invoke the mysqldump command aka the mysql backup command..... any1 please reply this thread.
regards
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, kit james!
Using a java.sql.Statement, you can execute database server specific queries. I'm not familiar with MySQL's dump command, but have you tried to simply execute a query using the same dump command that would be used from a MySQL console?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I just discovered that mysqldump.exe is an executable, not a MySQL command.
Take a look at The Runtime Class Documentation (and the getRuntime and exec methods).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic