- java.sql.Blob blob = rs.getBlob(2);
- InputStream in=blob.getBinaryStream();
- public static String getBlob(InputStream in) throws IOException {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- byte[] data = new byte[4096];
- int count = -1;
- while ((count = in.read(data, 0, 4096)) != -1)
- outStream.write(data, 0, count);
- data = null;
- String result = new String(outStream.toByteArray(), "gb2312");
- return result;
- }