Does anyone know how to export HSQLDB to .sql
file or something on a computer and restore on other computer.

- 28,416
- 10
- 82
- 109

- 139
- 1
- 1
- 3
-
2You can just copy the HSQLDB data file(s) (after shutting down HSQLDB of course) – Nov 09 '11 at 15:56
-
2this should be reopened as it relates to `software tools commonly used by programmers` - HSQLDB is a common tool especially in the java community – Richard Le Mesurier Nov 20 '13 at 14:20
-
I disagree that this should be reopened. It doesn't show any effort on the part of the OP. – Josh Darnell Nov 20 '13 at 14:41
2 Answers
To get a dump of the hsqldb file using either the embedded or file/server mode.
In an sql tools dialog use:
SCRIPT 'c:\path\to\db\db_sql.sql';
This will not work with spaces in the path
Please see the hsqldb docs

- 22,600
- 28
- 79
- 90

- 179
- 1
- 2
-
11Could you update the link to the doc to a specific page instead of the homepage? Thanks – j0k Sep 24 '12 at 11:27
-
I was trying to update the link, but my edit was rejected. Here is the link to the specific page where SCRIPT command is mentioned: http://www.hsqldb.org/doc/guide/sqlgeneral-chapt.html#N10406. The details you can dig up in http://www.hsqldb.org/doc/guide/management-chapt.html (you need to search for "script statement") – gawi Feb 20 '20 at 09:24
I was trying to export an HSQLDB database, out of an ODB file no less, and found it was very unintuitive. Oddly, I rarely found any tutorials or docs on just a simple export (the kind that is often done with, say, SQLite). I figured the included SqlTool was the right answer, but found nothing obvious ("You might use SCRIPT" is not helpful, sorry). Because this wasn't a database I knew anything about, I couldn't specify schema/table names, nor could I figure out a way to discover those.
In the end, I used an eval copy of RazorSQL (http://razorsql.com). I had to rename the database files to be .script, etc., according to RazorSQL's docs. I set up a Connection Profile that used the "JDBC (HSQLDB embedded)" connection type, selecting the script file that I found in the ODB database. Then I selected DB Tools from the menu, then Export Data, and selected the options that seemed appropriate (CSV file, in my case).
Hope this helps someone else.

- 146
- 5