4 Replies Latest reply: Sep 15, 2007 5:43 PM by 807600 RSS

    taking mysql backup

    807600
      i am new to java and i am creating a new application first time .....i want to take backup of my database which is in mysql5.0.37 ....i have used mysqldump in command prompt but i am not able to do this task in java ......is there any class for this or is there any oter way ......plz help .....i am in severe need.....plz....thanks in advance....
        • 1. Re: taking mysql backup
          796254
          why would you want to do this through Java? the command prompt seems like the appropriate place to do such a thing.

          %
          • 2. Re: taking mysql backup
            807600
            duffymo wrote:
            why would you want to do this through Java? the command prompt seems like the appropriate place to do such a thing.

            %
            I was wondering the exact same thing, but given my limited database administration skills, I wasn't sure if there was a genuine/actual need for such a thing.
            • 3. Re: taking mysql backup
              796254
              Navy_Coder wrote:
              duffymo wrote:
              why would you want to do this through Java? the command prompt seems like the appropriate place to do such a thing.

              %
              I was wondering the exact same thing, but given my limited database administration skills, I wasn't sure if there was a genuine/actual need for such a thing.
              I'm betting mine are more limited than yours. 8)

              You can always invoke the .cmd that you run in the command shell using Runtime.exec(). But do read this first:

              http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
              • 4. Re: taking mysql backup
                807600
                i know i had read all this in the link provided and i again read it ...but it is not possible for me do what i want to do .....i just want that there will be a button through which user could be able to click and take backup ....but in the upper script as no error comes but even nothing happen...i am pasting my script here can any one tell me if there is anything wrong i have done.......

                -----------------------------------------------------------------------------------------------------
                try
                {           
                Runtime rt = Runtime.getRuntime();

                proc = rt.exec("mysqldump --opt --user=root test > e:/pp.sql");

                int exitVal = proc.exitValue();
                out.println("Exit value "+exitVal);


                } catch (Throwable t)
                {
                t.printStackTrace();
                }