You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Abi Bala <ab...@gmail.com> on 2007/10/12 20:48:05 UTC

can bind a LONG value only for insert into a LONG column

Hi all,

We are using iBatis in our project and Oracle 9i JDBC Driver.
When trying to insert/update columns with Data type VARCHAR2(4000) using
inline parameters works fine when the data to be inserted is smaller.
But when the data to be inserted is near 4000 characters,the following
exception occurrs.

--- Cause: java.sql.SQLException: ORA-01461: can bind a LONG value only for
insert into a LONG column
; PREVIOUS EXCEPTION: (com.ibatis.common.jdbc.exception.NestedSQLException:

The data to be inserted is a String object.Why does it throw a "LONG" value
exception?

Also tried with parameter maps having declared as below:

<parameter property="commentText" javaType="java.lang.String"
jdbcType="LONGVARCHAR" typeHandler="
com.ibatis.sqlmap.engine.type.StringTypeHandler" nullValue="VARCHAR"/>

But still getting the same exception.

Thanks in advance.

Re: can bind a LONG value only for insert into a LONG column

Posted by Richard Yee <ry...@cruzio.com>.
Abi,
The LONG is a database type that is for varchars that exceed a certain 
size. There are some problems with the 9i JDBC driver and inserts over 
4k. I suggest you upgrade to the 10g driver if possible and consult the 
Oracle documentation. You can also Google for the problem (ie. JDBC 
Ora-01461)

-Richard

Abi Bala wrote:
>
> Hi all,
>
> We are using iBatis in our project and Oracle 9i JDBC Driver.
> When trying to insert/update columns with Data type VARCHAR2(4000) 
> using inline parameters works fine when the data to be inserted is 
> smaller.
> But when the data to be inserted is near 4000 characters,the following 
> exception occurrs.
>
> --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG value 
> only for insert into a LONG column
> ; PREVIOUS EXCEPTION: 
> (com.ibatis.common.jdbc.exception.NestedSQLException:  
>
> The data to be inserted is a String object.Why does it throw a "LONG" 
> value exception?
>  
> Also tried with parameter maps having declared as below:
>
> <parameter property="commentText" javaType="java.lang.String" 
> jdbcType="LONGVARCHAR" 
> typeHandler="com.ibatis.sqlmap.engine.type.StringTypeHandler" 
> nullValue="VARCHAR"/>
>
> But still getting the same exception.
>
> Thanks in advance.
>