db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Kenji Shikida" <shik...@gmail.com>
Subject Re: saving zipped CLOB raises a "A truncation error"
Date Wed, 05 Jul 2006 03:30:13 GMT
this is probably the reason because I ws trying to insert a 100MB object there.

I'll recreate the table using a bigger clob size

thanks!

K.

On 7/4/06, Kristian Waagan <Kristian.Waagan@sun.com> wrote:
> Leonardo Kenji Shikida wrote:
> > then I tried to change it to a BLOB, inserting byte[]
> >
> > and I've got
> >
> > Exception in thread "main" org.apache.derby.client.am.SqlException: A
> > truncation error was encountered trying to shrink BLOB 'XX-RESOLVE-XX'
> > to length 1048576.
> >     at org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
> >     at
> > org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown
> > Source)
> >     at org.apache.derby.client.net.NetStatementReply.readExecute(Unknown
> > Source)
> >     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
> > Source)
> >     at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown
> > Source)
> >     at org.apache.derby.client.am.PreparedStatement.executeX(Unknown
> > Source)
> >     at org.apache.derby.client.am.PreparedStatement.execute(Unknown Source)
> >     at
> > org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
> >
> >     at
> > org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
> >
> >
> >
> > any ideas?
>
> Hello Kenji,
>
> How do you define your CLOB/BLOB column and how big is your data?
> I can see from the error message that the column is restricted to 1 M
> (1*1024*1024 = 1048576 bytes) of data. This is the *default* LOB size in
> earlier versions of Derby. It has now been changed to 2 GB.
>
> If Derby receives more data than can fit into a CLOB column, it will try
> to truncate it by removing trailing whitespace. If this is not possible,
> it will fail the way your stacktraces are describing.
>
> I suggest you try to specify a larger maximum size for your CLOB/BLOB
> column. Note that 2 GB is the maximum size of LOBs. If you don't know
> how big your data can get, it is safe to specify the largest possible
> limit for the column.
> There are some issues with large LOBs and out-of-memory exceptions, but
> these are being worked on.
>
>
> Please let us know how if you sort out your problem, or ask questions if
> you get stuck!
>
>
>
>
> Regards,
> --
> Kristian
>
>
> >
> > []
> >
> > Kenji
> >
> > On 7/4/06, Leonardo Kenji Shikida <shikida@gmail.com> wrote:
> >> I am trying to store a zipped string into a CLOB column, just like this
> >>
> >> String compressedMatrix =
> >> ZipUtils.compress(matrix.getBuffer().toString());
> >> pstmt.setString(2,compressedMatrix);
> >>
> >> where ZipUtils is
> >>
> >>         public static String compress(String is) throws Exception{
> >>                  ByteArrayInputStream bais = new
> >> ByteArrayInputStream(is.getBytes());
> >>                  ByteArrayOutputStream baos = new
> >> ByteArrayOutputStream();
> >>                  compress(baos,bais);
> >>                  byte[] xx = baos.toByteArray();
> >>                  return new String(xx);
> >>         }
> >>         public static void compress(OutputStream os, InputStream is)
> >> throws Exception{
> >>                 byte[] buf = new byte[1024];
> >>         ZipOutputStream out = new ZipOutputStream(os);
> >>         out.putNextEntry(new ZipEntry("compressed"));
> >>         int len;
> >>         while ((len = is.read(buf)) > 0) {
> >>             out.write(buf, 0, len);
> >>         }
> >>         out.close();
> >>         is.close();
> >>         out.close();
> >>         }
> >>
> >> but I am getting this exception
> >>
> >> Exception in thread "main" org.apache.derby.client.am.SqlException: A
> >> truncation error was encountered trying to shrink CLOB 'PK' to
> >> length
> >>
> >>         at
> >> org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
> >>         at
> >> org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown
> >> Source)
> >>         at
> >> org.apache.derby.client.net.NetStatementReply.readExecute(Unknown Source)
> >>         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 Source)
> >>         at
> >> org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> >>         at
> >> org.apache.derby.client.am.PreparedStatement.executeX(Unknown Source)
> >>         at
> >> org.apache.derby.client.am.PreparedStatement.execute(Unknown Source)
> >>
> >> I suppose that I don't have to specify charsets because it's assuming
> >> it's the default one (UTF-8)
> >>
> >> Any ideas? Invalid chars? In a CLOB column?
> >>
> >> []
> >>
> >> Kenji
> >> _______________________
> >> http://kenjiria.blogspot.com
> >> http://gaitabh.blogspot.com
> >>
> >
> >
>
>


-- 

[]

Kenji
_______________________
http://kenjiria.blogspot.com
http://gaitabh.blogspot.com

Mime
View raw message