Results 1 to 5 of 5
  1. #1
    timoxa is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Problem with BACKUP and RESTORE MYSQL DATABASE

    Hello everybody,
    I have problem with mysql backup,
    this is code
    public boolean backupDB(String dbName, String dbUserName, String dbPassword, File path) {
    String host="localhost";
    FileWriter fw=null;
    try{
    fw = new FileWriter(path + ".sql");
    Runtime rt = Runtime.getRuntime();
    Process child = rt.exec("C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysqldump -h"+host+" -u"+dbUserName+" -p"+dbPassword+" finindex");
    JOptionPane.showMessageDialog(null, "Копия база данных успешно завершена !", "Внимание!", JOptionPane.INFORMATION_MESSAGE);
    InputStream in = child.getInputStream();
    InputStreamReader xx = new InputStreamReader(in,"utf8");
    char[] chars=new char[1024];
    int ibyte=0;
    while((ibyte=xx.read(chars))>0)
    {
    fw.write(chars);
    }
    fw.close();
    }catch (Exception e1) {
    e1.printStackTrace();
    }
    return false;
    }

    problem, in some computer it's work normal in same don't work.
    where is problem, the mysqldump directory is ok.
    Thank you !

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: Problem with BACKUP and RESTORE MYSQL DATABASE

    What is that didn't work? Can you post any error message that you saw while running your program? Are you running you application under the same operating system?

  3. #3
    timoxa is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Problem with BACKUP and RESTORE MYSQL DATABASE

    this code work normal but the file is created .sql file size is 0

  4. #4
    timoxa is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Problem with BACKUP and RESTORE MYSQL DATABASE

    yes I run my program in Win 7, Win Xp

  5. #5
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: Problem with BACKUP and RESTORE MYSQL DATABASE

    Could it be an authentication issue, like you don't have access from the other computer to your database?

Similar Threads

  1. Problem uploading a PDF to MySQL database
    By seristee in forum JDBC
    Replies: 9
    Last Post: 02-29-2012, 01:24 PM
  2. Problem connecting to mysql database
    By Kelly in forum JDBC
    Replies: 18
    Last Post: 07-22-2010, 07:40 AM
  3. problem in connecting to mysql database
    By nancyv in forum Java Servlet
    Replies: 6
    Last Post: 04-02-2008, 12:33 PM
  4. Replies: 0
    Last Post: 03-29-2008, 04:36 PM
  5. MySQL 5.0 data backup from java
    By sanjay_sharma77 in forum JDBC
    Replies: 1
    Last Post: 11-06-2007, 01:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •