strSql=" update REPORT set REPORT_CONTENT = ? where REPORT_ID=22" PreparedStatement preStmt = dbconn.prepareStatement ( strSql ) ;
byte[] contentBook = jBreport.writeToBlob () ;
ByteArrayInputStream inStream = new ByteArrayInputStream( contentBook ) ;
preStmt.setBinaryStream( 1 , inStream , inStream.available () ) ;
preStmt.executeUpdate () ;
其中REPORT_CONTENT就是image型。
byte[] contentBook = jBreport.writeToBlob () ;
ByteArrayInputStream inStream = new ByteArrayInputStream( contentBook ) ;
preStmt.setBinaryStream( 1 , inStream , inStream.available () ) ;
preStmt.executeUpdate () ;
其中REPORT_CONTENT就是image型。
ImageWriter writer = (ImageWriter)writers.next();
ImageOutputStream ios = null;
try{ ios = ImageIO.createImageOutputStream(new FileOutputStream("myPicture.jpg"));}
catch(IOException ioe){}writer.setOutput(ios);
try{ writer.write(bufferedImage);}
catch(IOException ioe){}
package javax.imageio available since JDK 1.4