I have having trouble getting HSQLDB to create a table with a boolean column. It seems every time I try to specify a default, I get the exception:
org.hsqldb.HsqlException: unexpected token: DEFAULT
I can create this problem even with this trivial table definition:
CREATE TABLE foo (
bar BOOLEAN NOT NULL DEFAULT FALSE
);
According to the documentation, I should be able to do this!
See columnDefinition in http://www.hsqldb.org/doc/guide/ch09.html#create_table-section
Have I misunderstood something here?
The default value of Boolean is False .
HSQLDB is used for development, testing, and deployment of database applications. The main and unique feature of HSQLDB is Standard Compliance. It can provide database access within the user's application process, within an application server, or as a separate server process.
Open the “Data Source Explorer” view using Window > Show view > Other and create a new Database Connection. Choose HSQLDB from the list of Connection Profile Types and provide a name, e.g. Library. Next, add a New Driver Definition and specify hsqldb. jar in the JAR List tab.
From the HSQLDB doc provided, the correct syntax is
CREATE TABLE foo (
bar BOOLEAN DEFAULT FALSE NOT NULL
);
i.e. The order matters in the SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With