Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8538209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:05:24+00:00 2026-06-11T11:05:24+00:00

I want to take backup of database. I am using mysql databse and wamp

  • 0

I want to take backup of database. I am using mysql databse and wamp server.For that i have written the following code.

Process runtimeProcess =Runtime.getRuntime().exec("C:\\wamp\\bin\\mysql\\mysql5.5.20\\bin\\mysqldump.exe -u root -pkarma dailyreport -r  "+assign+"\\dailyreport.sql");  
int processComplete = runtimeProcess.waitFor();  
if(processComplete == 0)
{  
JOptionPane.showMessageDialog(null, "Backup has been taken successfully", "BackUp", JOptionPane.INFORMATION_MESSAGE);
} 
else 
{  
JOptionPane.showMessageDialog(null, "Could not take backup", "BackUp", JOptionPane.INFORMATION_MESSAGE); 
}

In above code String assign denotes the the path where i want to save the backup of database. But problem is that i am taking the location to save backup at runtime.and if I select path where folder name contains space it could not take backup because System does not getting the path as it contains space.Please help me how should i change the runtime.getruntime.exec() command.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:05:25+00:00Added an answer on June 11, 2026 at 11:05 am

    Enclose the path in double quotes. That would help the shell see the entire argument as a single one instead of multiple arguments due to presence of space.

    Process runtimeProcess = 
        Runtime.getRuntime().exec("C:\\wamp\\bin\\mysql\\mysql5.5.20\\bin\\mysqldump.exe "
            + "-u root -pkarma dailyreport -r  \"" 
            + assign + "\\dailyreport.sql\" ");  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written certain code to take the Backup of a Database, the application
I want to take backup or restore of my oracle database through .Net code.
I want to take daily backup of my DB for that I use following
Hi i want to take database backup at daily mid night using cron job...
I want to take database backup from server PC to client PC. I can
I want to write a small backup script that would take my shelf changes
I have been using a mysql db backup script in php and the backups
I want to take back up of mysql database table in sql file through
I have a directory structure as: /apps/amr . I want to take a backup
i want to take the backup of all the data in the database of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.