日期:2014-05-16 浏览次数:20418 次
?如下代码,经过测试的!O(∩_∩)O哈哈~
?
数据库:oracle9
驱动 : ojdbc14_g.jar
?
注意:不同的版本、不同的驱动写法不一样....?
?
??? 这里是写clob ??
DataSource dataSource = jdbcTemplate.getDataSource(); try { Connection conn = dataSource.getConnection(); PreparedStatement stmt = conn.prepareStatement("update zyfiles set txt=? where href = '"+filename+"'"); //将字符串转行为流的形式 Reader clobReader = new StringReader(sBuffer.toString()); stmt.setCharacterStream(1, clobReader, sBuffer.toString().length()); int num = stmt.executeUpdate(); if (num > 0) { System.out.println(filename+"成功"); }else { System.out.println(filename+"失败======================"); } stmt.close(); conn.close(); } catch (Exception e) { }
?
?