Java从数据库取出BLOB数据放入map中,从map中拿出转换成String类型数据

for (Map map:list){
            **Blob blob=((BLOB) map.get("FILEDATA"));**//得到并强转成BLOB
            String content="";
            try {
                **content = new String(blob.getBytes((long)1, (int)blob.length()));**//转成String
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

你可能感兴趣的:(JAVA)