File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes JDBC / Oracle / Blob: compatibility problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC / Oracle / Blob: compatibility problem" Watch "JDBC / Oracle / Blob: compatibility problem" New topic
Author

JDBC / Oracle / Blob: compatibility problem

Mike Himstead
Ranch Hand

Joined: Apr 12, 2006
Posts: 178
Hi,

I have a problem browsing a result set containing a single result with a Blob from an Oracle DB. Debugging shows that the result set does contain the Blob (I can see the byte array), but when I try to get it with:


Note: Blob is java.sql.blob, rowset is of type sun.jdbc.rowset.CachedRowSet


I get an Exception:

Exception: [B incompatible with java/sql/Blob
Stack Trace:
java.lang.ClassCastException: [B incompatible with java/sql/Blob
at sun.jdbc.rowset.CachedRowSet.getBlob(CachedRowSet.java:5235)
at sun.jdbc.rowset.CachedRowSet.getBlob(CachedRowSet.java:5375)
at de.volkswagen.ipad.tv.model.service.impl.ProtocolServiceImpl.createFileDateDTO(ProtocolServiceImpl.java:336)
at de.volkswagen.ipad.tv.model.service.impl.ProtocolServiceImpl.downloadProtocol(ProtocolServiceImpl.java:304)
at de.volkswagen.ipad.tv.controller.SearchProtocolAction.execute(SearchProtocolAction.java:101)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at de.volkswagen.ipad.servlets.IpadControllerServlet.process(IpadControllerServlet.java:113)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
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:1577)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
at de.volkswagen.ipad.util.monitoring.IpadMonitor.doFilter(IpadMonitor.java:471)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at de.volkswagen.ipad.util.filter.FilterSessionInitializer.doFilter(FilterSessionInitializer.java:70)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:89)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1936)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:114)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1471)

As far as I know, there aren't different Blob types on Oracle, so what might cause this problem?
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
This may help.

http://download-uk.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/oralob2.htm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC / Oracle / Blob: compatibility problem