LUZ11 de Marzo del 2005
PreguntaHola estoy trabajanod con oracle y jsp.
Con el siguiente código muestro una imagen tipo BLOB, el problema es que no me permite mostrar datos texto en la misma página
<% String VPrepaI = request.getParameter("un_numero_preparacion");
if (VPrepaI != null) { %>
<HR><BR>
<% } %>
</FORM>
</TABLE>
</BODY>
</HTML>
<%
Connection conn = null;
Statement stmt = null;
String url = "jdbc:oracle:oci8:@";
String usuario = "scott";
String password = "tiger";
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection (url, usuario, password);
conn.setAutoCommit(false);
stmt = conn.createStatement();
PreparedStatement sql = conn.prepareStatement("SELECT foto FROM foto_temp " +
"WHERE nombre = '" + VPrepaI + "'");
ResultSet rs = sql.executeQuery();
rs.next();
InputStream in = rs.getBinaryStream("foto");
byte[] b = new byte[1024*1024];
int len;
while((len=in.read(b)) >0)
response.getOutputStream().write(b,0,len);
in.close();
rs.close();
} catch (IOException e) {
} catch (SQLException e) {
}
%>
Con el siguiente código muestro una imagen tipo BLOB, el problema es que no me permite mostrar datos texto en la misma página
<% String VPrepaI = request.getParameter("un_numero_preparacion");
if (VPrepaI != null) { %>
<HR><BR>
<% } %>
</FORM>
</TABLE>
</BODY>
</HTML>
<%
Connection conn = null;
Statement stmt = null;
String url = "jdbc:oracle:oci8:@";
String usuario = "scott";
String password = "tiger";
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection (url, usuario, password);
conn.setAutoCommit(false);
stmt = conn.createStatement();
PreparedStatement sql = conn.prepareStatement("SELECT foto FROM foto_temp " +
"WHERE nombre = '" + VPrepaI + "'");
ResultSet rs = sql.executeQuery();
rs.next();
InputStream in = rs.getBinaryStream("foto");
byte[] b = new byte[1024*1024];
int len;
while((len=in.read(b)) >0)
response.getOutputStream().write(b,0,len);
in.close();
rs.close();
} catch (IOException e) {
} catch (SQLException e) {
}
%>
