This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Urgent..Problem while using java.sql.Blob in JSP
 
It's not a secret anymore!