wood burning stoves 2.0*
The moose likes JDBC and the fly likes Problem in inserting large file in CLOB in Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in inserting large file in CLOB in Oracle" Watch "Problem in inserting large file in CLOB in Oracle" New topic

Problem in inserting large file in CLOB in Oracle

sandy comp

Joined: Aug 11, 2001
Posts: 10
Hi friends.
I have problem while inserting data into CLOB datatype of Oracle. I'm able to insert samll files into CLOB say having 4000 characters, but if this limit exceds I'm unable to insert file into CLOB. I tried both otions on java.sql.PreparedStatement
viz. setAsciiStream() and setBinaryStream().
Anyone have solution on this. Please let me know as early as possible.
Thanks in advance.


Design and programming are human activities; forget that and all is lost.
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
are you doing somthing like this . if not try it .
//your code
stmt = conn.createStatement();
rs1 = stmt.executeQuery("select * from mytable where mycolumn = "+myvar
+" for update");
my_clob = ((OracleResultSet)rs1).getCLOB(yourcolumnindex);
public void insertClob(oracle.sql.CLOB clob,String value) throws Exception
OutputStream outstream = clob.getAsciiOutputStream();
}catch(Exception e){e.printStackTrace();}

# Help an unprivileged kid.<br /> Whatever u do will make a difference...<br /> ...to a child's life & ur own #<br /><a href="http://www.cry.org/" target="_blank" rel="nofollow">www.cry.org/</a>
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

There is source code to an example using LOB's. The writeCLOB(...) method uses a different approach to writing the CLOB.
Consider Paul's rocket mass heater.
subject: Problem in inserting large file in CLOB in Oracle
Similar Threads
Using CLOBs with JPA
Writing a Clob in Java
Error: Active Spring transaction synchronization required
how to upload size > 4k file to oracle BLOB field
CLOB with Oracle thin driver