friends,,
i wanna resize the image with specific dimensions while retrieving from database
here is my code
help me

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %> 

<% 
 Connection connection = null;
ResultSet rs = null;
PreparedStatement psmnt = null;
InputStream sImage;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
connection = DriverManager.getConnection("jdbc:odbc:ravi", "system", "system");
psmnt = connection.prepareStatement("SELECT image FROM inimage ");
rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
response.reset();
response.setContentType("image/jpeg");
while((size=sImage.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
}
}
}
catch(Exception ex){
out.println("error :"+ex);
}
finally {
rs.close();
psmnt.close();
connection.close();
}
%>

You want to do this database connection in servlet and there is also place where you can call on a function that will do resizing