Menu

Restoring a Backup Documentation issue, lack of second parameter

L R
2016-01-05
2016-02-14
  • L R

    L R - 2016-01-05

    Running version 2.3.3
    http://hsqldb.org/doc/guide/management-chapt.html
    Example 11.4, java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackupMain --extract tardir/backup.tar dbdir
    Command line arguments did not work, neither did Google.
    Very happy that source code was provided, so I began the debugger and found out that in the Strings[] args.. command there are two steps, (inside the DbBackupMain.java file)
    Line 104 sa[0] == --extract, and then line 106 sa[1] --overwrite
    Documentation is not present on the meaning and work. Created command to work as follows that does work on hyperSQL engine,

    String ext = "--extract";
    String overWrite = "--overwrite";
    String backup_tar = "C:\Users\me\Documents\dbs\me-20160104T115823.tar.gz"
    String dest = "C:\Users\me\Documents\dbs\live\me"
    String[] batchCmd = {ext, overWrite, backup_tar, dest };
    DbBackupMain.main(batchCmd);

    Would request better interaction, could I write it?

     
  • Blaine Simpson

    Blaine Simpson - 2016-02-14

    Backup section of doc should say to run

    java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackupMain
    

    to get full command-line syntax help. If you run that, you will see the optional --extract parameter documented. I will add this to the user guide. Thanks for alerting us.

    Code does not need to be changed, as example 11.4 works perfectly with HyperSQL 2.3.3 as-is. The purpose of that example is to show how to restore to a new database (the most common use case by far), not to show how to overwrite an existing database. If you attempt to run the example command when there is already a database in the specified restore location, it reports something like:

    Exception in thread "main" java.io.IOException: Extracted file already exists: /home/blaine/db/dbdir/db.properties

    At that point, it's up to the user whether they really intend to overwrite, and if so, they should use the --overwrite switch which is explained (with all other parameters) by running

    java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackupMain
    

    This is the wrong place to report problems with Google.

     

    Last edit: Blaine Simpson 2016-02-14

Log in to post a comment.