From derby-user-return-12667-apmail-db-derby-user-archive=db.apache.org@db.apache.org Mon Apr 26 17:32:55 2010 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 93759 invoked from network); 26 Apr 2010 17:32:55 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Apr 2010 17:32:55 -0000 Received: (qmail 88964 invoked by uid 500); 26 Apr 2010 17:32:55 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 88941 invoked by uid 500); 26 Apr 2010 17:32:55 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 88924 invoked by uid 99); 26 Apr 2010 17:32:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 17:32:53 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.6.24] (HELO gmp-eb-inf-2.sun.com) (192.18.6.24) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 17:32:43 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged)) by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o3QHWLRU003416 for ; Mon, 26 Apr 2010 17:32:22 GMT MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0L1H00G00V3P6K00@fe-emea-09.sun.com> for derby-user@db.apache.org; Mon, 26 Apr 2010 18:31:48 +0100 (BST) Received: from [192.168.0.198] ([unknown] [84.215.174.92]) by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0L1H00JFOVCWKB00@fe-emea-09.sun.com> for derby-user@db.apache.org; Mon, 26 Apr 2010 18:31:48 +0100 (BST) Date: Mon, 26 Apr 2010 19:31:41 +0200 From: Kristian Waagan Subject: Re: A truncation error was encountered trying to shrink VARCHARTA 'XX-RESOLVE-XX' to length 255. In-reply-to: <28366428.post@talk.nabble.com> Sender: Kristian.Waagan@Sun.COM To: Derby Discussion Message-id: <4BD5CDFD.7030408@Sun.COM> References: <4BD47F8C.9030106@sun.com> <28366428.post@talk.nabble.com> User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.1.8) Gecko/20100329 Lightning/1.0b1 Thunderbird/3.0.3 X-Virus-Checked: Checked by ClamAV on apache.org 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 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 >> >> >