【发布时间】:2013-12-09 20:27:37
【问题描述】:
我正在执行以下操作以将其插入 BLOB Oracle 11g。
图像以 Base64 编码 存储在从 XML 中提取的字符串中。
String str = "xyz...."
byte[] bytes = str.getBytes();
InputStream is = new ByteArrayInputStream(bytes);
PreparedStatement prepStmt = dbCon.prepareStatement("insert into Table(INDEX,RESPONSE_IMAGE) values(?,?);
prepStmt.setString(1, action.getIndex());
prepStmt.setBinaryStream(2, is, str.length());
我认为问题是图像的字节长度,因为当我得到字符串的长度()时,它大约是 200,000 字节。
当我对字符串执行 subString(3000) 时,它很容易保存在 BLOB 列中。
那么问题到底出在哪里??
- 图片长度是否过长?
- 或者我应该选择 Oracle 的任何其他数据类型?
我读到 BLOB 最多可以保存 4GB 数据,那为什么不是我的呢??
【问题讨论】:
标签: java oracle jdbc oracle11g