Re: JDBC HELP PLEASE ! Cannont set string larger than 2147 in setString ! JDBC java.sql.SQLException: Data size bigger than max size for this type: 2147

From: Jacques Leplat <jacques_at_cableinet.co.uk>
Date: Wed, 03 Nov 1999 20:07:23 GMT
Message-ID: <7vq4lb$sid$1_at_news1.cableinet.co.uk>


There are a few things you can try. setObject() with LONGVARCHAR as the type. If that doesn't work, you can try using a stream. The code below shows the iterations I went through when dealing with large pieces of text. Using the AsciiStream did it for me.

      myInsertStatement.setAsciiStream(1, new ByteArrayInputStream(myText.getBytes()), myText.getBytes().length);

      // myInsertStatement.setObject(1, myText, Types.LONGVARCHAR);
      //myInsertStatement.setString(1, myText);


Arman Ali Anwar <arman.anwar_at_mci.com> wrote:

>Greetings,

>I have an urgent production problem where I have to bind to a stored
>procedure variable that is a long now if i use setString(var) where
>var's length is > 2147 I get an exception ..

>Please help and I would appreciate replies to arman.anwar_at_wcom.com

>Arman.
Received on Wed Nov 03 1999 - 21:07:23 CET

Original text of this message