"A truncation error was encountered trying to shrink CLOB..."
I google'd for the error, but wasn't able to find something that jumps right out, and helps me fix the issue. So, after mucking around for a few minutes, a bulb went over my head: I had let hibernate create / update the table schema as it saw fit. Sure enough, hibernate created a CLOB that was too small.
The default CLOB size assigned by hibernate was 255, which, IMHO, is WAY too small for a CLOB. I mean, why use a CLOB at all, if you are just going to store 255 bytes. A varchar would be a much better choice.
Anyway, so I deleted the table (manually), and re-created it with the default size of 2GB.
ij> describe report_description;
COLUMN_NAME |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
------------------------------------------------------------------------------
NAME |VARCHAR |NULL|NULL|255 |NULL |510 |NO
FIELDS |CLOB |NULL|NULL|255 |NULL |NULL |YES
2 rows selected
ij> drop table REPORT_DESCRIPTION;
0 rows inserted/updated/deleted
ij> create table REPORT_DESCRIPTION(name varchar(255), fields clob);
0 rows inserted/updated/deleted
ij> describe report_description;
COLUMN_NAME |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
------------------------------------------------------------------------------
NAME |VARCHAR |NULL|NULL|255 |NULL |510 |YES
FIELDS |CLOB |NULL|NULL|21474&|NULL |NULL |YES
2 rows selected
My app ran fine after that.
Note that Apache Derby does not care about the case of the table / field names.
No comments:
Post a Comment