inserting into CLOB (jdbc)

From: Doug Cha <dcha_at_shell2.ba.best.com>
Date: 04 Jun 1999 02:30:05 GMT
Message-ID: <37573a2d$0$207_at_nntp1.ba.best.com>


I've scoured the documentation and have tried a number of things but it is unclear to me how I should insert into CLOB columns using JDBC (on 8i using Oracle 8.1.5 drivers).

For example (using bits and pieces of relevant code:):

        mytable (myclob clob)

Stream into the column on insert?

        ByteArrayInputStream bais = 
	    new ByteArrayInputStream(myString.getBytes());
	pstmt.setAsciiStream(1,bais,myString.length());

  	-This seems to be for LONGVARCHAR and returns an error 
	 ("ORA-01461")

Insert a blank record, select from it in order to get the CLOB locator, then update the record using a CLOB ? (This seems somewhat strange but nonetheless...):

	// after the select
	CLOB myclob = ((OracleResultSet)rset).getCLOB (1);
	myclob.putString(1,myString);

	-This gives a "Data size bigger than max size for this 
	 type.." error.  

Any hints?

--
dcha_at_best.com
Received on Fri Jun 04 1999 - 04:30:05 CEST

Original text of this message