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.java :86)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr ocessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 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]

