MySQLのBLOBに登録された画像を表示させるサンプル(java struts) //DBをOPENする処理を入れる ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); InputStream in = null; byte b[] = new byte[4096]; sql = "select BFILE from BLOB_DATA where ID="+id; rs = stmt.executeQuery(sql); if( rs.next() ){ in = rs.getBinaryStream("BFILE"); } while (true) { int bytes = in.read(b); if (bytes == -1) { break; } byteOut.write(b,0,bytes); } in
![BLOBの画像を表示 - MARCO's FREE MEMO](https://cdn-ak-scissors.b.st-hatena.com/image/square/18337b867c5b68f99dd84af1850edce7c70fbdac/height=288;version=1;width=512/https%3A%2F%2Fblogimg.goo.ne.jp%2Fuser_image%2F20%2F0f%2F0437c9a5bdb0af493c50df3ace4f3ccd.jpg)