Kevin Wu wrote:
I use embedded derby as my database, but when I save a Blob to DB, it throw the following exception, I am wandering how to solve the matter. It looks the BLOB only 255 bytes. How can I save a 64k bytes to the BLOB column.

Hello Kevin,

Can you show us the SQL used to create the table, or just the SQL specifying the BLOB column? If you did not specify a maximum length for the BLOB column, something is wrong in Derby, because the default should be 2GB -1 bytes (assuming your using a recent version of Derby).

Assuming you have not found a Derby bug, the error message you get says that the Blob is too big for the column it is being inserted into. And Derby is not able to shrink it. (The 'XX-RESOLVE-XX' looks a bit scary, but I think it is only put there in lack of a name for the Blob).



regards,
--
Kristian


Caused by: _java.sql.SQLException_: A truncation error was encountered trying to shrink BLOB 'XX-RESOLVE-XX' to length 255.

at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)

at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)

at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)

at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)

at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)

at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)

at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(_NonBatchingBatcher.java:23_)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(_AbstractEntityPersister.java:2197_)

    ... 69 more


Reply via email to