使用PreparedStatement setString 时抛出异常

数据库为Oracle9i 字段为varchar2(2000) 当插入700+个汉字的时候抛出了 插入值过大的异常

不解中 从网上google了一下 发现了Oracle JDBC的实现有些问题,因为一直用CLOB,所以还是第一次碰见这种问题

pst.setCharacterStream(1,new InputStreamReader(new ByteArrayInputStream(s.getBytes())), s.length());

使用流就可以了,呵呵。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章