[jboss-user] [JCA/JBoss] - Re: Reading of Oracle BLOB works with JBoss 3.2.3 but fails

gpsabado do-not-reply at jboss.com
Tue May 29 23:25:32 EDT 2007


On my case, this code snippets runs on Oracle 9i, but when I deploy the WAR  using Oracle 10g as the backend, exception occured on casting
 
here is the code:

if (id!= null) {
                    stmt2=conn.prepareStatement("SELECT content from pps_designdocument_revs where id = "+id);
                    rs=stmt2.executeQuery();
                    if (rs!=null && rs.next()){
                        oracle.sql.BLOB objectBlob = (oracle.sql.BLOB)rs.getObject("CONTENT");
                        byte[] buffer = new byte[objectBlob.getBufferSize()];
                        int bytesRead = 0;
                        inputStream = desDocRev.getContents();
                        outputStream = objectBlob.getBinaryOutputStream();
                        while ((bytesRead = inputStream.read(buffer)) != -1){
                            outputStream.write(buffer, 0, bytesRead);
                        }
                        outputStream.flush();
                        outputStream.close();
                        inputStream.close();
                        conn.commit();
                    }
                    DataSourceBroker.close(rs);
                    DataSourceBroker.close(stmt2);
                }else{
                    conn.rollback();
                }

Here is the error:

javax.servlet.ServletException: oracle.sql.BLOB cannot be cast to oracle.sql.BLOB




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049572#4049572

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049572



More information about the jboss-user mailing list