I have read some threads that allude to a specific issue with Blob (lob) sizes with DB2.
My understanding is that if I specify the max length of the Blob within the Hibernate mapping file for the Blob Column then DB2 will not assume a default size.
My ddl for the table specifies a max size of 4Mb for both Clob and Blob columns. I have also given this value in the hibernate mapping file (see below), but I get the error:
"The specified size of the InputStream, parameter #5, is less than the actual InputStream length"(see below for stack trace) when inserting a blob. this occurs even when the blob size is small (40Kb).
I am also using org.springframework.orm.hibernate3.LocalSessionFactoryBean and configuring it with the org.hibernate.dialect.DB2Dialect.
Inserting to the Clob column works fine, it is just the Blob insert that I can't get any further with.
Many thanks in advance for any help.
Hibernate version: 3.2
Mapping documents:
<class name="DespatchSupportFile" table="DespatchSupportFile">
<id name="id" type="long" column="despatchsupportfileid" unsaved-value="null">
<generator class="assigned"/>
</id>
<property name="despatchId" type="long" column="despatchid" not-null="true"/>
<property name="contentType" type="string" column="content_type" not-null="true"/>
<property name="fileName" type="string" column="file_name" not-null="true"/>
<property name="textFile" type="clob" column="text_file" not-null="false" length="4000000"/>
<property name="binaryFile" type="blob" column="binary_file" not-null="false" length="4000000"/>
</class>
Full stack trace of any exception that occurs:
[07/07/08 15:04:18:916 BST] 0000001d SystemOut O Hibernate: insert into DespatchSupportFile (despatchid, content_type, file_name, text_file, binary_file, despatchsupportfileid) values (?, ?, ?, ?, ?, ?)
[07/07/08 15:04:18:947 BST] 0000001d JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: -99999, SQLState: null
[07/07/08 15:04:18:963 BST] 0000001d JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions [ibm][db2][jcc][t4][20102][11163] The specified size of the InputStream, parameter #5, is less than the actual InputStream length.
[07/07/08 15:04:18:978 BST] 0000001d AbstractFlush E org.hibernate.event.def.AbstractFlushingEventListener performExecutions Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.belmin.eps.domain.DespatchSupportFile]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:135)
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:48)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:835)
at org.springframework.transaction.jta.WebSphereUowTransactionManager.access$100(WebSphereUowTransactionManager.java:86)
at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:306)
at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)
at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:251)
at com.belmin.eps.service.DespatchSupportFileProcessor.doPersistance(DespatchSupportFileProcessor.java)
at com.belmin.eps.fileupload.MultiFileUploadServlet.doPost(MultiFileUploadServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1068)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:543)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3357)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:115)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: com.ibm.db2.jcc.b.SqlException: [ibm][db2][jcc][t4][20102][11163] The specified size of the InputStream, parameter #5, is less than the actual InputStream length.
at com.ibm.db2.jcc.c.jb.a(jb.java:325)
at com.ibm.db2.jcc.c.mb.a(mb.java:1380)
at com.ibm.db2.jcc.c.mb.a(mb.java:149)
at com.ibm.db2.jcc.c.wb.a(wb.java:159)
at com.ibm.db2.jcc.b.jg.a(jg.java:1758)
at com.ibm.db2.jcc.b.jg.d(jg.java:2175)
at com.ibm.db2.jcc.b.jg.W(jg.java:463)
at com.ibm.db2.jcc.b.jg.executeUpdate(jg.java:446)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:948)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:615)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
... 41 more
Name and version of the database you are using: DB2 v9.1.0.4
|