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型。

解决方案 »

  1.   

    Iterator writers = ImageIO.getImageWritersByFormatName("jpeg");
    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
      

  2.   

    http://www.jalice.net/IORoseTest.java.html