从数据库中取得图像文件的byte[] 
imageIcon的构造方法:ImageIcon(byte[] imageData) 

解决方案 »

  1.   

    // column is column index in ResultSet containing the image, 
    // we assume that the type is LONGVARBINARY
    Image myImage = null;
    InputStream stream = rset.getBinaryStream(column); 
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    try {
      int a1 = stream.read();
      while (a1 >= 0) {
        output.write((char)a1);
         a1 = stream.read();
         }
      myImage = 
        Toolkit.getDefaultToolkit().createImage(output.toByteArray());
      output.close();
      }
    catch(Exception e){}