Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> ORA 1461 Error while trying to insert into a CLOB column
Hi folks!
I am getting the following error while trying to insert something into an Oracle8 database:
"java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column"
I am using v8.0.5.0.5 of the JDBC drivers obtained from Oracle together with JDK 1.1.6. My column type is a CLOB and this only happens while trying to insert something over a certain size (i believe that the size limit is 4k). My question is as follows:
// this can be something as big as you can imagine.
String mydata = "something really really long.........";
int len = mydata.length();
BytaArrayInputStream bais = new ByteArrayInputStream(mydata.toBytes()); PreparedStatement ps = conn.prepeareStatement("insert into mytable values (?)");
ps.setAsciiStream(1,bais,len);
// Also tried the following:
// ps.setString(1,outputstream.toString());
ps.execute();
ps.close();
This does the insert for data of a certain size but croaks on anything that is over the size limit.
2. If I can somehow convert my string (mydata) to an OracleClob, then I
can use the setClob method to do the insert. Can I do this?
Any help is greatly appreciated. Thanks.
-Ajay Received on Mon Nov 30 1998 - 14:13:21 CST