He realizado lo siguiente, pero no me funciona:
Código PHP:
protected void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
moduloSQLSyb2 sql = new moduloSQLSyb2();
sql.conexion();
String nomImagen = "01020304050607080922";
ResultSet rs = null;
try {
rs = sql.obtenStreamImg (nomImagen);
if (rs != null){
rs.next();
// Se lee el contenido de la imagen devuelta
InputStream is = rs.getBinaryStream ("datosimg");
byte b[] = new byte[32000];
int c = is.read(b);
System.out.println ("Bytes leídos con éxito: " + c);
PrintWriter out = res.getWriter ();
res.setContentType ("image/gif");
out.println (b);
}
else {
System.out.println ("ResultSet devuelve nulo");
}
} catch (SQLException e){e.printStackTrace();}
catch (IOException e){e.printStackTrace();} }