• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Backing up database through java

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to every one
I have a doubt in java regarding creating the MySQL database dump.

My problem is...

i have a huge content in the database. i need to take a backup of the database on every day as i boot my system or as i open the application.

i am right now using a MySql Database 4.1.12 version. i just need to have a database backup..
how can i get that..

i know that thru the command promt or thru the shell prompt i can create a back up thru the syntax mysqldump -uusername -ppassword databasename > filename

but how do i achieve that thru Java..
my application work on a desktop machine where mysql server and the application are installed..

i need to backup the database and if possible compress the database dump file

I hope i will get a solution for this query

Thanks in advance
==========
Divakar
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

I don't know if MySQL has any APIs for this, so I'll assume it doesn't and go from there. It would be simplest to do the backup outside Java. Maybe make a batch or shell script to perform the backup and launch the Java app and invite the users to run that instead of starting Java. To run it from Java make a script that does the backup only and invoke it via Runtime.exec(). There's a bit more work to get that going, but it might be slick to have a "backup now" button inside your application.

BTW: The sheriff will doubtless be around to remind you that your user name must be a believable first & last name.
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On cue...

"Divakar",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
[ July 18, 2005: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MySQL has an administration GUI, that will allow you to backup as well as restore MySQL databases.

MySQL Administrator

Give it a try.
 
Ranch Hand
Posts: 158
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with both of them.

"To run it from Java make a script that does the backup only and invoke it via Runtime.exec(). There's a bit more work to get that going, but it might be slick to have a "backup now" button inside your application".

and Mr. Craig. using tools.
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic