sql - Backup and restore of Hsqldb database in java code -
sql - Backup and restore of Hsqldb database in java code -
i new in hsqldb database. want know how take backup , restore of hsqldb database through java code.
each hypersql database called catalog. there 3 types of catalog depending on how info stored.
types of catalog data :
mem: stored exclusively in ram - without persistence beyond jvm process's life
file: stored in filesystem files
res: stored in java resource, such jar , read-only
to running catalog, obtain jdbc connection , issue backup database command in sql. in simple form, command format below backup database single .tar.gz file given directory.
backup database <directory name> blocking [ files ]
the directory name must end slash distinguish directory, , whole string must in single quotes so: 'subdir/nesteddir/'.
to offline catalog, catalog must in shut downwards state. run java command
java -cp hsqldb.jar org.hsqldb.lib.tar.dbbackupmain --save tardir/backup.tar dbdir/dbname
. in example, database named dbname , in dbdir directory. backup saved file named backup.tar in tardir directory.
where tardir/backup.tar file path *.tar or *.tar.gz file created in file system, , dbdir/dbname file path catalog file base of operations name.
you utilize dbbackup on operating scheme command line restore catalog backup.
java -cp hsqldb.jar org.hsqldb.lib.tar.dbbackupmain --extract tardir/backup.tar dbdir
where tardir/backup.tar file path *.tar or *.tar.gz file read, , dbdir target directory extract catalog files into. note dbdir specifies directory path, without catalog file base of operations name. files created names stored in tar file. more details refer
java sql backup hsqldb
Comments
Post a Comment