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 Steven Pannell <st...@zooplus.com> on 2005/08/12 17:39:26 UTC

Problem getting BLOB from oracle

Hi,

I'm trying to get a BLOB from an oracle 10g DB but all I get are the first
few bytes.  I have the latest jdbc14.jar from oracle and the map looks like
this:

    <resultMap id="testMap" class="TestBean">
        <result property="content" column="document" jdbcType="BLOB"
typeHandler="com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback"/>
    </resultMap>

    <select id="test" resultMap="testMap" parameterClass="long">
        select document from document_table where id =  #value#
    </select>

My bean is as so..

public class TestBean {

    byte[] content;

    public byte[] getContent() {
        return this.content;
    }

    public void setContent(byte[] b) {
        content = b;
    }

}


What am I doing wrong?? I followed the wiki note...but still no joy.  anyone
some tips??

thx.
Steve.

Re: Problem getting BLOB from oracle

Posted by Nathan Maves <Na...@Sun.COM>.
An error would be nice :)

The only thing I can see is that you might try removing the  
typeHandler attribute.  iBatis will figure it out based on the jdbcType.

Nathan

On Aug 12, 2005, at 9:39 AM, Steven Pannell wrote:

> Hi,
>
> I'm trying to get a BLOB from an oracle 10g DB but all I get are  
> the first
> few bytes.  I have the latest jdbc14.jar from oracle and the map  
> looks like
> this:
>
>     <resultMap id="testMap" class="TestBean">
>         <result property="content" column="document" jdbcType="BLOB"
> typeHandler="com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback"/>
>     </resultMap>
>
>     <select id="test" resultMap="testMap" parameterClass="long">
>         select document from document_table where id =  #value#
>     </select>
>
> My bean is as so..
>
> public class TestBean {
>
>     byte[] content;
>
>     public byte[] getContent() {
>         return this.content;
>     }
>
>     public void setContent(byte[] b) {
>         content = b;
>     }
>
> }
>
>
> What am I doing wrong?? I followed the wiki note...but still no  
> joy.  anyone
> some tips??
>
> thx.
> Steve.
>