Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : J2EE : JSP : Figures Signup · Login
Author Thread
Figures
Posted in tutorial: Displaying Records from the Database with Java Servlets
·  laqa
User
Joined: 20 Oct 2002
Total Posts: 1

Figures

Posted: 20 Oct 2002
I am not getting the figures. I got the red X. MS IE 6 SP1.

Luis.
·  Faisal Khan
AdminAdminAdminAdmin
Joined: 24 Sep 2002
Total Posts: 594
Fixed that
Posted: 20 Oct 2002
You can see the images now.

Faisal Khan.
Stardeveloper.com
Read Blog | Follow on Facebook, Twitter
·  sushama
User
Joined: 28 Apr 2005
Total Posts: 2
how to display
Posted: 28 Apr 2005
how to display images in oracle database table(blob),
iam getting an error like IOException:JVM_recv inputstrem......................
using servletsmy program is as follows,
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class BlobTest extends HttpServlet{
public void service(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
{
try {

ServletOutputStream out = res.getOutputStream();
DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracle","scott","tiger");
PreparedStatement pstmt = conn.prepareStatement("INSERT INTO BlobTest VALUES( ?, ? )" );
pstmt.setString( 1, "photo1");
File imageFile = new File("C:/bea/user_projects/mydomain/applications/sushama/images/pupkit11.jpg");
InputStream is = new FileInputStream(imageFile);
pstmt.setBinaryStream( 2, is, (int)(imageFile.length()));
pstmt.executeUpdate();
pstmt = conn.prepareStatement("SELECT image FROM BlobTest WHERE name = ?");
pstmt.setString(1, "photo1");
ResultSet rs = pstmt.executeQuery();
if(rs.next()) {
Blob blob = rs.getBlob(1);
int length = (int)blob.length();
byte [] _blob = blob.getBytes(1, length);

out.write(_blob);
}
System.out.println("Completed...");

} catch(Exception e) {
System.out.println(e.getMessage());
}
}
}

hai,i've inserted image into oracle i couldn't get it from d/b to my browser or applet using servlets, how to do
Want to leave a comment? Login or Register for free!

Users Who Have Visited This Thread In Last 24 Hours
2 Visitors

Login to post a comment or start a new thread
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2010 Stardeveloper.com, All Rights Reserved.