<%@ page language="java" contentType="image/jpeg" %>
<%@ page
import="java.util.*, java.sql.*, java.io.*" %>
<%
String sql =
"";
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
OutputStream output = response.getOutputStream();
InputStream input =
null;
try {
con =
DriverManager.getConnection("Jdbc:oracle:thin:@¼¹öÁÖ¼Ò:PORT:SID","USER","PASSWORD");
sql =" select imagedata from imageTable where id = '00000' ";
pstmt =
con.prepareStatement(sql);
rs = pstmt.executeQuery();
if
(rs.next()) {
input = rs.getBinaryStream("imagedata");
int
byteRead;
while((byteRead = input.read()) != -1) {
output.write(byteRead);
}
input.close();
}
}
catch(Exception e) {
out.print(e);
} finally {
try {if (rs !=
null) rs.close();} catch (Exception ex) {}
try {if (pstmt != null)
pstmt.close();} catch (Exception ex) {}
try {if (con != null)
con.close();} catch (Exception ex) {}
}
input.close();
output.flush();
output.close();
%>