oracle更新clob字段的老问题

今天又出现“java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column”,郁闷呀,别的更新都没问题,偏偏就有一个就是更新不了,老报这个错误,我的oracle驱动是ojdbc14-10.2.0.1.0.jar,大家帮帮忙看是什么问题!感谢!



部分代码如下:

String sql = "update " + tableName + " set content=? where id=?";

PreparedStatement psbd = conn.prepareStatement(sql);

psbd.setString(1, dd.getContent());

psbd.setString(2, dd.getId());

int resultInt = psbd.executeUpdate();

其中content用的是clob类型。

虽然传说中Oracle的新JDBC驱动程序可以把CLOB当作String处理,但不知道到底怎么样,还是老老实实用流吧!

clob是不能作为参数的
用流传入才行

http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html

oracle这样说:Instead of the standard APIs, Oracle extension APIs can be used. OraclePreparedStatement.setStringForClob() can be used for binding data greater than 32765 bytes.