简体   繁体   中英

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 . 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;

Can you say jdbc version you are using? It works correctly to me with

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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