大家好,IBATIS操作CLOB字段的问题,原来是这么操作的:
TABLE:
ID VARCHAR2(2)
CONTENNT CLOB在程序中插入时:
String id = "12";
String content="helloworld";IBATIS执行插入语句 INSERT INTO TABLE VALUES(#id#,#content#)
是可以执行成功但是当content内容非常大,有10M左右会比较慢,请问有什么解决的方法吗?ibatisCLOB
TABLE:
ID VARCHAR2(2)
CONTENNT CLOB在程序中插入时:
String id = "12";
String content="helloworld";IBATIS执行插入语句 INSERT INTO TABLE VALUES(#id#,#content#)
是可以执行成功但是当content内容非常大,有10M左右会比较慢,请问有什么解决的方法吗?ibatisCLOB
解决方案 »
- jpa+spring 无法向数据库插入数据(无错误提示信息)
- hashtable 求助
- 救命啊,eclipse的debug工具的问题,恳请各位高手赐答
- 关于Webmail:Jwma和Claros各有什么优缺点?各能提供什么功能
- 解析啊。。。。。。。。。
- java 七层(英文全名)
- 能推荐一本hibernate入门的书吗?
- 用struts技术,怎么显示数据啊。
- 为什么我按下在JColorChooser中按确定以后没有效果呢?
- Struts1从后台向Jsp页面发送数据取到的时null
- POI给Excel成功追加数据之后,如何让Excel重新计算
- 我的spring配置文件中viewResolver添加web前后缀不起作用,请大家帮忙
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); System.out.println("---------"
+ sf.format(Calendar.getInstance().getTime()));
while (rset.next()) {
// Get the lobs
BLOB blob = ((OracleResultSet) rset).getBLOB(2);
CLOB clob = ((OracleResultSet) rset).getCLOB(3);
// Change the lob contents
fillClob(clob, 8000000);
}
System.out.println("---------"
+ sf.format(Calendar.getInstance().getTime()));
rset.close();
stmt.close();
conn.close();
其中:
static void fillClob(CLOB clob, long length) throws Exception {
Writer outstream = clob.getCharacterOutputStream(); int i = 0;
int chunk = 10; while (i < length) {
outstream.write(i + "hello world", 0, chunk); i += chunk;
if (length - i < chunk)
chunk = (int) length - i;
}
outstream.close();
}打印结果:
// ---------20121225 18:17:58
// ---------20121225 18:18:03
如果硬是内容较大,需要用到clob,建议直接将文件上传