File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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 /> a child's life & ur own #<br /><a href="" target="_blank" rel="nofollow"></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.
I agree. Here's the link:
subject: Problem in inserting large file in CLOB in Oracle
It's not a secret anymore!