Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long string data type in H2 databases

Tags:

java

sql

h2

I am trying to create an H2 database to manage some text clippings. One of the fields will contain a large string that may be hundreds and, in a few instances, thousands of words long.

Ideally I would not want to limit the size of this field at the moment when the table is created; it'd be best for this to be dynamically sized, but if that is not possible would want to allocate generously so that the text is not cut. Any suggestions on how to implment this? Is VARCHAR(10,000) possible? crazy? Thanks.

like image 380
K Owen - Reinstate Monica Avatar asked Dec 10 '11 01:12

K Owen - Reinstate Monica


1 Answers

You can use a CLOB Data Type. Take a look at their data type page:

CLOB is like VARCHAR, but intended for very large values. Unlike when using VARCHAR, large CLOB objects are not kept fully in-memory; instead, they are streamed. CLOB should be used for documents and texts with arbitrary size such as XML or HTML documents, text files, or memo fields of unlimited size.

like image 137
felipecrp Avatar answered Oct 16 '22 08:10

felipecrp