So what would be the best way of converting that wrapper class into an OracleResultSet?

Is the problem that an OracleResultSet extends java.sql.ResultSet and the Wrapper implements it?

Nathan
On Apr 21, 2004, at 5:29 PM, Niall Pemberton wrote:

So if its not an OracleResultSet, then what kind is it?

I believe if you use something like Commons dbcp it uses wrappers for
everything - DelegatingResultSet

Niall

----- Original Message -----
From: "Nathan Maves" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, April 22, 2004 12:15 AM
Subject: what could cause this Class Cast exception


I know this is not truly struts related but...

I had a servlet that loaded blobs from oracle (pdf files). This worked
perfect. I copied the code into my action and I know receive this
error:


java.lang.ClassCastException
at
reporting.viewer.presentation.actions.ViewReport.execute(ViewReport.ja va
:86)
at
org.apache.struts.action.RequestProcessor.processActionPerform(Request Pr
ocessor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav a:
274)


here is the code....


// Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env");

         // Look up our data source
         DataSource ds = (DataSource)
envCtx.lookup("jdbc/report-viewer");

         // Allocate and use a connection from the pool
         Connection conn = ds.getConnection();
         PreparedStatement ps = null;
         ResultSet rs = null;

.....

if (rs.next()) {
                 OracleResultSet ors = (OracleResultSet)rs;
----------------(THIS IS LINE 86 of ViewReport.java)
                 BLOB blob = ors.getBLOB(2);

                 if (blob != null) {
                     response.setContentType(rs.getString(1));

                     InputStream is = blob.getBinaryStream();
                     int size = blob.getBufferSize();
                     byte[] buffer = new byte[size];
                     int length = -1;

                     while ((length = is.read(buffer)) != -1) {
                         out.write(buffer, 0, length);
                     }
                 }
             }


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to