You need to cast the ResultSet to the Oracle specify ResultSet
-----Original Message-----
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 11:01 AM
To: Tomcat Users List
Subject: [OT] getBlob() error in Tomcat
Importance: High
Hi,
Any idea why this error is coming in runtime?
Servlet) - FileDisplayServlet.doPost()
java.lang.AbstractMethodError:
oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/String;)Ljava/sql/
Blob;
at
org.apache.commons.dbcp.DelegatingResultSet.getBlob(DelegatingResultSet.java
:318)
at
com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(FileDisplayServl
et.java:169)
I am trying to display a image that is stored in a BLOB field in Oracle. I
am using connection pooling and classes12.jar
Servlet Code
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------
private void readBlob
(
HttpServletRequest request,
HttpServletResponse response,
long aFeatureId,
String aFileName,
String aUserId
)
throws SQLException,IOException
{
Connection conn = null;
ResultSet result = null;
PreparedStatement prepStmt = null;
java.io.InputStream in = null;
java.sql.Blob myBlob = null;
FileUploadFactory uploadFactory = new FileUploadFactory();
try
{
conn = config_.getEstimationConnection(false);
String sql = "";
sql =
" SELECT "+
" FILE_IMAGE "+
" FROM "+
" OES_FEATURE_DETAILS "+
" WHERE "+
" FEATURE_ID = "+aFeatureId;
log_.debug("SQL:==="+sql);
log_.debug("result=" + result);
prepStmt = conn.prepareStatement(sql);
result = prepStmt.executeQuery();
if (result != null && result.next())
{
//get the file ext
String strDocExt = "";
try
{
strDocExt =
uploadFactory.getFileType(aFileName, aUserId);
}
catch(Exception e)
{
log_.debug("Exception is"+e);
}
//get the file length
int intCountBytes = 0;
String strPrpValue = null;
//set the mimetype
ResourceBundle mimetype =
ResourceBundle.getBundle("mimes");
strPrpValue =
mimetype.getString(strDocExt.toLowerCase());
log_.debug("Value=" + strPrpValue);
if (strPrpValue != null)
{
response.setContentType(strPrpValue);
response.setHeader("Content-Disposition", "inline; filename=" + aFileName);
}
myBlob = result.getBlob("FILE_IMAGE");
//get the inputStream
in = myBlob.getBinaryStream();
/*Get the Output Stream*/
if (in != null)
{
generatePresentation(in, response);
in.close();
}
}
}
catch (SQLException sqle)
{
throw new
SQLException("FileDisplayServlet.readBlob", "" + sqle.getErrorCode());
}
catch (IOException io)
{
throw new
IOException("FileDisplayServlet.readBlob");
}
finally
{
try
{
if (result != null)
{
result.close();
}
if (prepStmt != null)
{
prepStmt.close();
}
if (conn != null)
{
conn.close();
}
}
catch (SQLException sqle)
{
throw new
SQLException("FileDisplayServlet.readBlob");
}
}
}
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----
Best Regards
Abhay Kumar
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]