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 6840685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:52:26+00:00 2026-05-26T23:52:26+00:00

I have a struts 2 (jsp) web application with MySQL database . Is it

  • 0

I have a struts 2 (jsp) web application with MySQL database.

Is it possible to take database backup from jsp/java page?

Is it possible to restore in the same way?

Please give me some tutorials or tips..

My actual need is to give a access to admin to take back up and restore it using gui itself, without accessing MySQL from server.

Thanks in advance..

  • 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-05-26T23:52:27+00:00Added an answer on May 26, 2026 at 11:52 pm

    If you are using mySQl you can do something like

       static int BUFFER = 10485760;      
    
    public static String getData(String host, String port,    String user, String password, String db) throws Exception {
    
    Process run = Runtime.getRuntime().exec(
               "C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysqldump --host="  + host + " --port=" + port + 
               " --user=" + user + " --password=" + password +
               " --compact --databases --add-drop-table --complete-insert --extended-insert " +
               "--skip-comments --skip-triggers "+ db);
    InputStream in = run.getInputStream(); 
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    StringBuffer temp = new StringBuffer();
    int count;
     char[] cbuf = new char[BUFFER];
    
    while ((count = br.read(cbuf, 0, BUFFER)) != -1)
             temp.append(cbuf, 0, count);
    
     br.close();
     in.close();
    
     return temp.toString();
    }
    
    public static void main(String[] args) {
    byte[] data = BackupRestore.getData("localhost", "3306",
        "root", "", "test").getBytes();     
    File filedst = new File(path);
    FileOutputStream dest = new FileOutputStream(filedst);
    dest.write(data);
    }
    

    But i believe until you have not any compelling/fancy reason to do this better user command line tools

    You can use GUI tool being shipped with MySQL,more tested and more easy to use.

    String path="C:/datadump/db_backup.sql"
    

    make sure that path C:/datadump should exist or you can provide any other path of your choice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSP struts application that uses Spring to integrate with the services/dao/database.
I have an already developed web application based on struts 1.2 which contains jsp
I have a java based web application(struts 1.2). I have a requirement to display
I have a web application which runs on MySQL, and uses Java, Struts2 and
I have web application developed using JSP and struts. I am just looking out
I'm using Java+struts2+JSP as the web application framework. I have to pass some huge
I have the following code in a jsp page (Struts backed): <c:if test=${USERINFO.someproperty ==
We have a Struts 2 web application that's used by pretty much every employee
Setup : I have a Struts web application where I use displaytag elements to
I have a Struts based web application that has a structure similar to the

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.