aspose file tools
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Problem in inserting large file in CLOB in Oracle" Watch "Problem in inserting large file in CLOB in Oracle" New topic
Author

Problem in inserting large file in CLOB in Oracle

sandy comp
Greenhorn

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");
if(rs1.next())
{
my_clob = ((OracleResultSet)rs1).getCLOB(yourcolumnindex);
insertClob(my_clob,myclobvalue);
}
stmt.execute("commit");
rs1.close();
stmt.close();
...
...
public void insertClob(oracle.sql.CLOB clob,String value) throws Exception
{
try
{
OutputStream outstream = clob.getAsciiOutputStream();
outstream.flush();
outstream.write(value.getBytes());
outstream.close();
}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

http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.htm
There is source code to an example using LOB's. The writeCLOB(...) method uses a different approach to writing the CLOB.
Jamie
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Problem in inserting large file in CLOB in Oracle
 
Similar Threads
Using CLOBs with JPA
Error: Active Spring transaction synchronization required
CLOB with Oracle thin driver
Writing a Clob in Java
how to upload size > 4k file to oracle BLOB field