You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Mark Thornton <mt...@optrak.co.uk> on 2010/05/06 12:42:02 UTC

Truncating CLOB error

Caused by: org.apache.derby.client.am.SqlException: Java exception: 'A 
truncatio
n error was encountered trying to shrink CLOB '<stream-value>' to length 
255.: o
rg.apache.derby.iapi.services.io.DerbyIOException'.

I am getting this when a user adds an event with more than 255 
characters using the Bedework calendar system. It is using Derby version 
10.5.3.

Subsequently Derby fails with locking timeouts

Caused by: java.sql.SQLTransactionRollbackException: A lock could not be 
obtaine
d within the time requested
         at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unkn
own Source)
         at 
org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
e)
         at 
org.apache.derby.client.am.PreparedStatement.executeQuery(Unknown Sou
rce)

Which I suspect is a consequence of the earlier problem

I found a more complete stack trace here:

org.apache.derby.client.am.SqlException: Java exception: 'A truncation 
error was
  encountered trying to shrink CLOB '<stream-value>' to length 255.: 
org.apache.d
erby.iapi.services.io.DerbyIOException'.
         at org.apache.derby.client.am.Statement.completeExecute(Unknown 
Source)
         at 
org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unk
nown Source)
         at 
org.apache.derby.client.net.NetStatementReply.readExecute(Unknown Sou
rce)
         at 
org.apache.derby.client.net.StatementReply.readExecute(Unknown Source
)
         at 
org.apache.derby.client.net.NetPreparedStatement.readExecute_(Unknown
  Source)
         at 
org.apache.derby.client.am.PreparedStatement.readExecute(Unknown Sour
ce)
         at 
org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Sour
ce)
         at 
org.apache.derby.client.am.PreparedStatement.executeUpdateX(Unknown S
ource)
         at 
org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown So
urce)
         at 
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdat
e(WrappedPreparedStatement.java:365)

Any suggestions welcome.

Mark Thornton



Re: Truncating CLOB error

Posted by Mark Thornton <mt...@optrak.co.uk>.
On 06/05/2010 14:21, Kristian Waagan wrote:
>
> Hi Mark,
>
> Derby is only allowed to truncate whitespace. If it needs to truncate 
> non-whitespace characters to make the value fit, it will throw an 
> exception (not a warning).
>
>
Ah, thanks. I seem to remember that some databases will truncate anything.

Thanks,
Mark


Re: Truncating CLOB error

Posted by Kristian Waagan <Kr...@Sun.COM>.
On 06.05.10 15:04, Mark Thornton wrote:
> On 06/05/2010 13:52, Marco Ferretti wrote:
>> *maybe* you are affected by this
>> http://opensource.atlassian.com/projects/hibernate/browse/HHH-2614?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
>>
>
> Very likely, especially as Mike Douglass is I believe one of the main
> developers of Bedework. Would you expect Derby to be merely reporting a
> warning for the truncation and that it would be Hibernate that is
> promoting this to failure?

Hi Mark,

Derby is only allowed to truncate whitespace. If it needs to truncate 
non-whitespace characters to make the value fit, it will throw an 
exception (not a warning).


Regards,
-- 
Kristian

>
> Thanks,
> Mark Thornton
>


Re: Truncating CLOB error

Posted by Mark Thornton <mt...@optrak.co.uk>.
On 06/05/2010 13:52, Marco Ferretti wrote:
> *maybe* you are affected by this
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-2614?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
>

Very likely, especially as Mike Douglass is I believe one of the main 
developers of Bedework. Would you expect Derby to be merely reporting a 
warning for the truncation and that it would be Hibernate that is 
promoting this to failure?

Thanks,
Mark Thornton


Re: Truncating CLOB error

Posted by Marco Ferretti <ma...@gmail.com>.
*maybe* you are affected by this
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2614?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel


On Thu, May 6, 2010 at 2:24 PM, Mark Thornton <mt...@optrak.co.uk>wrote:

>  On 06/05/2010 12:38, Marco Ferretti wrote:
>
> Hi
> some simple questions that could address the issue ( I am not familiar with
> that calendar system ) : are you using some ORM ? Did you check the table ?
> ( the size of the CLOB )
>
>
> The ORM is Hibernate. I haven't checked the table, but I presume that the
> underlying column is a varchar(255). I'll do some more checks later when I
> don't have users wanting to see their calendars.
>
> Mark
>
>


-- 
"No Im sorrys, no apologies, no regrets..... "

Re: Truncating CLOB error

Posted by Kristian Waagan <Kr...@Sun.COM>.
Den 06.05.10 14:24, skrev Mark Thornton:
> On 06/05/2010 12:38, Marco Ferretti wrote:
>> Hi
>> some simple questions that could address the issue ( I am not familiar
>> with that calendar system ) : are you using some ORM ? Did you check
>> the table ? ( the size of the CLOB )
>>
>
> The ORM is Hibernate. I haven't checked the table, but I presume that
> the underlying column is a varchar(255). I'll do some more checks later
> when I don't have users wanting to see their calendars.

Hi Mark,

If you have remote access to your / a database, you can use ij and issue 
"describe <tablename>;" to figure out the type and maximum length of the 
column.


hth,
-- 
Kristian

>
> Mark
>


Re: Truncating CLOB error

Posted by Mark Thornton <mt...@optrak.co.uk>.
On 06/05/2010 12:38, Marco Ferretti wrote:
> Hi
> some simple questions that could address the issue ( I am not familiar 
> with that calendar system ) : are you using some ORM ? Did you check 
> the table ? ( the size of the CLOB )
>

The ORM is Hibernate. I haven't checked the table, but I presume that 
the underlying column is a varchar(255). I'll do some more checks later 
when I don't have users wanting to see their calendars.

Mark


Re: Truncating CLOB error

Posted by Marco Ferretti <ma...@gmail.com>.
Hi
some simple questions that could address the issue ( I am not familiar with
that calendar system ) : are you using some ORM ? Did you check the table ?
( the size of the CLOB )

Marco

On Thu, May 6, 2010 at 12:42 PM, Mark Thornton <mt...@optrak.co.uk>wrote:

> Caused by: org.apache.derby.client.am.SqlException: Java exception: 'A
> truncatio
> n error was encountered trying to shrink CLOB '<stream-value>' to length
> 255.: o
> rg.apache.derby.iapi.services.io.DerbyIOException'.
>
> I am getting this when a user adds an event with more than 255 characters
> using the Bedework calendar system. It is using Derby version 10.5.3.
>
> Subsequently Derby fails with locking timeouts
>
> Caused by: java.sql.SQLTransactionRollbackException: A lock could not be
> obtaine
> d within the time requested
>        at
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unkn
> own Source)
>        at org.apache.derby.client.am.SqlException.getSQLException(Unknown
> Sourc
> e)
>        at org.apache.derby.client.am.PreparedStatement.executeQuery(Unknown
> Sou
> rce)
>
> Which I suspect is a consequence of the earlier problem
>
> I found a more complete stack trace here:
>
> org.apache.derby.client.am.SqlException: Java exception: 'A truncation
> error was
>  encountered trying to shrink CLOB '<stream-value>' to length 255.:
> org.apache.d
> erby.iapi.services.io.DerbyIOException'.
>        at org.apache.derby.client.am.Statement.completeExecute(Unknown
> Source)
>        at
> org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unk
> nown Source)
>        at org.apache.derby.client.net.NetStatementReply.readExecute(Unknown
> Sou
> rce)
>        at org.apache.derby.client.net.StatementReply.readExecute(Unknown
> Source
> )
>        at
> org.apache.derby.client.net.NetPreparedStatement.readExecute_(Unknown
>  Source)
>        at org.apache.derby.client.am.PreparedStatement.readExecute(Unknown
> Sour
> ce)
>        at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown
> Sour
> ce)
>        at
> org.apache.derby.client.am.PreparedStatement.executeUpdateX(Unknown S
> ource)
>        at
> org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown So
> urce)
>        at
> org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdat
> e(WrappedPreparedStatement.java:365)
>
> Any suggestions welcome.
>
> Mark Thornton
>
>
>


-- 
"No Im sorrys, no apologies, no regrets..... "