Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQLException on inserting string using JDBC

Re: SQLException on inserting string using JDBC

From: Shaun Tancheff <shaun_at_tancheff.com>
Date: Tue, 08 Feb 2000 01:10:17 GMT
Message-ID: <389f638a.416770@news>


On Fri, 04 Feb 2000 15:44:11 -0500, Mukul Sood <msood_at_iframe.com> wrote:

>Hello All,
>
>I am having problems inserting a large string, size 64kb, in Oracle
>8.0.5
>database.

I'm currently fight the same 'feature'
AFAIK you have to use what Oracle calls 'streams' to do this.

  http://www.hvcc.edu/admin/hvccinfo/oracle8doc/a58237/toc.htm

>I'm using a PreparedStatement to do the insert.
>pstmt.setString(1, myString)

  String longString = "really long ... ";   int len = longString.length();
  ByteArrayInputStream stream =

      new ByteArrayInputStream( longString.getBytes() );   pstmt.setBinaryStream( 1, stream, len );

>This is the error message -
>java.sql.SQLException: data size bigger than max size for this type

Change it to this and you get:
  Works fine when I send 3753 characters.   Get this error with 4163 characters, hmm I smell a   4K limit (or is that 8K w/Java?).

java.sql.SQLException:

   ORA-01461: can bind a LONG value only for insert into a LONG column

>I'm using Oracle thin driver for Oracle 8.0.5 - classes111b.zip
>My schema looks like this -
>Table Name - TestTable
>Column Name - TestString
>datatype - LONG

It's an easy enough (code) tweek, if you have better luck I'd love  to hear it.

>The Oracle LONG datatype supports upto 2gb of char data,
>so am not sure why I get this error.

>Pls. let me know if there is any workaround, or there's some version
>of Oracle driver which fixes this problem.
>
>Thnx.
>
>Mukul

 http://shaun.tancheff.com/       /?/                 -_-
  :-) shaun ;-] shaun_at_tancheff.com (Shaun Tancheff) .sigs freed Received on Mon Feb 07 2000 - 19:10:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US