db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: A truncation error was encountered trying to shrink VARCHARTA 'XX-RESOLVE-XX' to length 255.
Date Mon, 26 Apr 2010 17:31:41 GMT
On 26.04.10 17:45, OggieOne64 wrote:
>
> Thanks for responding but the problem is that I am trying to insert an image
> (not text). The field is of type Blob.
> Any other ideas? BTW: How can I verify what version of derby is running? My
> derby.jar is dated 8/10/2009

Hi Doug,

Can you post the stack trace from the exception?
Are you sure Hibernate is mapping the column to the right column type?

Regarding the Derby version, one way to figure it out is invoke the 
command below with at least one of the Derby jars (i.e. derby.jar, 
derbyclient.jar etc) in the classpath:
java -cp <yourclasspath> org.apache.derby.tools.sysinfo
       		 or potentially
java -jar derbyrun.jar sysinfo

I don't remember exactly, but I think you can use JDBC meta data calls 
as well. You can also look at some files inside one of the jars, for 
instance the manifest file, and if you start ij the version is printed 
(not the full version, i.e. only 10.5).


Regards,
-- 
Kristian

>
> Thanks,
> Doug
>
>
>
> Knut Anders Hatlen wrote:
>>
>> On 04/24/10 17:18, Doug McGavin wrote:
>>> I am using the latest version of Derby with Hibernate and getting the
>>> following error when trying to save an image (the exact same code works
>>> with MySQL) :
>>>
>>> [7613120@qtp0-8] ERROR util.JDBCExceptionReporter  -
>>>
>>> A truncation error was encountered trying to shrink VARCHARTA
>>> 'XX-RESOLVE-XX' to length 255.
>>>
>>> I have read that this is a known bug but I don't seem to be able to find
>>> how it was resolved or how to work around it in my code.
>>
>> Hi Doug,
>>
>> I think this error means you're trying to insert a string that's longer
>> than 255 characters into a VARCHAR(255) column. Derby will try to
>> truncate the string if it has trailing spaces, but the above exception
>> will be thrown if that's not enough to make it fit in the column.
>>
>> In Derby 10.5 and later, the error message should show the string you're
>> trying to insert instead of the rather cryptic string 'XX-RESOLVE-XX'.
>> (The error message was changed in DERBY-961.)
>>
>> --
>> Knut Anders
>>
>>
>


Mime
View raw message