title: MYSQL Backup using java GUI
body: <p>I am trying to backup my database and this is the code I've written but for some reason it is not backing up?? i am using <code>local host (MAMP)</code> and the operating system I am using is <code>MAC OSX</code>.  </p>
  
  <pre><code>public boolean databaseBackup(String dbName, String dbUserName, String dbPassword, String path) {
          String qu = "/Applications/MAMP/Library/bin/mysqldump -u" + dbUserName + " -p" + dbPassword + " --database" + dbName + " -r " + path;
  
  System.out.println(qu);
  
  Process runtimeProcess;
  
  Properties pr = new Properties();
  
  pr.setProperty("user", "username");
  
  pr.setProperty("password", "password");
  
      Connection con = null;
  
      PreparedStatement stmt = null;
  
      try {
          con = DriverManager.getConnection("jdbc:mysql://localhost:8889/Database", pr);
          runtimeProcess = Runtime.getRuntime().exec(qu);
          int processComplete = runtimeProcess.waitFor();
          if (processComplete == 0) {
              System.out.println("5");
  
              System.out.println("Backed up");
              return true;
          } else {
              System.out.println("Not Backed up");
          }
      } catch (Exception ex) {
          ex.printStackTrace();
      }
      return false;
  }
  </code></pre>
  
  <p>}</p>
  
  <hr>
  
  <p>in my jframe form  I wrote this:             </p>
  
  <pre><code>code.databaseBackup("Database","root", "root", "/Users/dipeshramesh/Dropbox/TeamProject/TeamProject2.sql");
  </code></pre>
  
  <p>so when a person press backup button it calls <code>code.databaseBackup</code> method and dose its jobs.</p>
  
  <p>if I run this it shows a message "Not Backed up" dose any know this?</p>