Marcin
Marcin

Reputation: 7994

Storing long strings (CLOB) in Hsqldb databases?

So here's some code:

statement.executeUpdate("CREATE TABLE SomeTable(id INTEGER IDENTITY, " +
    "text CLOB)");

which throws an exception "Wrong data type: CLOB in statement [...]". Is there a way to store CLOBs in Hsqldb databases? The documentation says it is. Or maybe my knowledge of SQL is so rusty that I forgot how to define them.

Upvotes: 9

Views: 9420

Answers (2)

fredt
fredt

Reputation: 24382

In version 2.0 and above, CLOB is a supported type. For your example, you should add PRIMARY KEY explicitly.

statement.executeUpdate("CREATE TABLE SomeTable(id INTEGER IDENTITY PRIMARY KEY, " +
    "text CLOB)");

Upvotes: 4

objects
objects

Reputation: 8677

Try LONGVARCHAR instead of CLOB

Upvotes: 12

Related Questions