简体   繁体   English

使用.setClob()时发生异常

[英]Exception while using .setClob()

I want to insert a String via a Java Program into Oracle DB in a table having column type as CLOB . 我想通过Java程序将字符串插入列类型为CLOB的表的Oracle DB中。 I am using the following code 我正在使用以下代码

 PreparedStatement stmt=conn.prepareStatement("insert into Json_Test values(?,?)");
 stmt.setInt(1,counter);
 stmt.setClob(2,new StringReader(s));

But while executing i am getting an Exception: java.lang.Exception: 1 - oracle.jdbc.driver.OraclePreparedStatementWrapper.setClob(ILjava/io/Reader; 但是在执行时我得到一个异常: java.lang.Exception: 1 - oracle.jdbc.driver.OraclePreparedStatementWrapper.setClob(ILjava/io/Reader;

Can you say jdbc version you are using? 可以说您正在使用的jdbc版本吗? It works correctly to me with 它对我正确工作

dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.3</version>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM