aspose file tools*
The moose likes JSP and the fly likes Urgent..Problem while using java.sql.Blob in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Urgent..Problem while using java.sql.Blob in JSP" Watch "Urgent..Problem while using java.sql.Blob in JSP" New topic
Author

Urgent..Problem while using java.sql.Blob in JSP

Srinivas Saranu
Greenhorn

Joined: Oct 02, 2002
Posts: 7
hi
i want to retrieve an image from oracle database which is stored in the database as BLOB. iam using JSP to display the image on the browser. Iam using tomcat 3.3 with apache 1.3. JDK 1.3
the code i have written in JSP is as follows
ResultSet rs=st.executeQuery("select picture from prt");
while(rs.next()){
try{
Blob data=rs.getBlob("picture");
byte[] b=data.getBytes(1,(int)(data.length()));
}
catch(Exception e){
out.println(e);
}
}
when i execute the JSP page iam getting the following exception
Error: 500
Location: /dna/jsp/gcImages.jsp
Internal Servlet Error:
java.lang.AbstractMethodError at jsp.gcImages_1._jspService(gcImages_1.java:229)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
please help me who can.Thank you one and all
srinivas
Sateesh Kumar K
Greenhorn

Joined: Oct 16, 2001
Posts: 11
Hi,
You need to Typecast the ResultSet to oracle.jdbc.driver.OracleResultSet and then you can use the
(BLOB)oracleresultset.getBlob()
method of it..
I don't think default ResultSet will provide the implementation for fetching a BLOB Data type from Oracle.
Hope this will help..
-Sateesh
Srinivas Saranu
Greenhorn

Joined: Oct 02, 2002
Posts: 7
Thank you very much
 
 
subject: Urgent..Problem while using java.sql.Blob in JSP