1

I have a database named "Clients" and i want to get only "contacts" table without taking other database tables as a backup. I want to do this in my java swing application and please help me with this problem.

2
  • 1
    this has nothing at all to do with Swing. Swing is just a framework that can be used to provide the user with a GUI. Select the table to backup, store it in memory, write it to another destination (file, other table, ... ) Commented Dec 5, 2018 at 11:15
  • Here is a post (and answer) about MySQL: Backing up single table. I guess rest of the Swing GUI can take care of the application. Link to Java's Swing Tutorials. I think you should Google little bit and look for specific questions and answers. Commented Dec 5, 2018 at 11:27

1 Answer 1

1

Here is a way it can be done.

In the Swing application there can be a function for backup database. This function can be triggered from a menu option or a button. Let us take a button click as an example.

Create a JButton with name "Backup Database" in the application. Add an ActionListener to the button. The actionPerformed method has the function's logic: This opens a JDialog with a status JTextArea, JButtons to select a target folder/file name of the backup, start the process, close the dialog, etc. The status area can display the selected folder, the output file name, success/error messages, etc. The process:

  1. Select the destination folder
  2. May be, there is an option to select the table name to be backed up
  3. Build the target filename (probably has a timestamp included in the filename)
  4. Click the start button: Run a SQL DDL using JDBC's Statement object's executeUpdate method. This runs the SQL to create the backup and updates the status area with the backup file name -or- in case of an exception displays an appropriate message (and followup actions).

The dialog can look like this:

enter image description here


Also, see these posts:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.