Question

In my java project, i want to use HSQLDB database for my application so i am studying HSQLDB, i just want to know is it possible to backup and restore HSQLDB database from within application or from outside of application ?

Was it helpful?

Solution

Yes it is possible to take backup of HSQLDB database from HSQL Database Manager i.e. Swing GUI provided by HSQL for database management. Follow the instructions step by step and you will have the backup of your database in encrypted format,i have also taken backup using java code as well,but first of all lets take a backup using HSQL Database Manager.

STEPS

  1. Go to the folder of your HSQLDB database, in my case it is hsqldb-2.3.1.

  2. Locate the bin folder of HSQLDB i.e. hsqldb-2.3.1\hsqldb\bin.

  3. In bin folder you will find batch files providing GUI for database management of HSQLDB.

  4. Run the batch file named runManagerSwing.bat, a GUI will open titled "HSQL Database Manager".

  5. Connect to your database.

  6. Fire the following query for taking backup:
    BACKUP DATABASE TO <filename with entire path> BLOCKING
    for example,
    BACKUP DATABASE TO 'C:\Users\admin\Desktop\BAQCKUP\Maximus.tgz' BLOCKING

A backup file will be generated at the specified path. Make use of the above query in your java code as well and it will work.

OTHER TIPS

How to Take Backup and Restore :

Backup :

Your Path> java -cp hsqldb-2.3.2.ja r org.hsqldb.lib.tar.DbBackupMain --save tardir/backup1.tar D:\opt\db\testdb

Restore :

java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackupMain --extract tardir/backup.tar dbdir

Yes it is possible to backup and restore HSQLDB database from within application or from outside of application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top