I need to insert a large string as clob into a table. I am using setClob method of PreparedStatement. But the values are not getting inserted into the database table. Can anyone
What database are you inserting the value to? For example for Oracle back-end, preparedStatement methods have 4k limitation on CLOB.
You could use:
Clob clob = ... String chuck = clob.getSubString(1,10); clob.setString(1,chuck);
To verify that the size is not the issue here.
I had the same problem using WebLogic and Oracle. I found the solution in the doc: http://docs.oracle.com/cd/B19306_01/appdev.102/b14259/xdb11jav.htm under the section "Loading a Large XML Document into the Database with JDBC"
The only problem I had with this was that the CLOB.createTemporary required an OracleConnection, but my connection object was of type $ProxyXX which I could not cast to OracleConnection without getting a ClassCastException. Solved it buy using conn.getMetaData().getConnection() that got me a T4CConnection which I could cast to OracleConnection.