• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Srinivas Saranu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic