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 Amit Kushwaha <bl...@googlemail.com> on 2007/02/13 17:39:22 UTC

REF CURSOR - DB2

Hi,

Just checking, 
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions

What if the database is DB2? Are DB2 versions of ref cursor's supported?

Regards,

Amit



Re: REF CURSOR - DB2

Posted by Amit Kushwaha <bl...@googlemail.com>.
A'ha. Thanks.

Jeff Butler wrote:
> When DB2 returns a result set from a stored proc, it is not as an 
> output parameter.  It's just like the result set returned from a 
> select statement.  So you don't declre an out parameter for the result 
> set, you just use a result map.
>  
> <procedure id="statementName" parameterClass="long", resultMap="product">
>     { call ProcName(#id#) }
> </procedure>
>  
>  
> Jeff Butler
>
>
>  
> On 2/13/07, *Amit Kushwaha* <bluenex@googlemail.com 
> <ma...@googlemail.com>> wrote:
>
>     Jeff,
>
>     Right. DB2 stored procs, that returns back a result set.
>
>     Do you need to specify the jdbcType on the output parameter that is a
>     resultset?
>
>     For ex, in the /<REFCURSOR> /below,
>
>     <resultMap id="product" class="Product">
>        <result property="name"  columnIndex="1"/>
>        <result property="description"  columnIndex="2"/>
>     </resultMap>
>
>
>     <procedure id="statementName" parameterClass="long">
>         { call #output, javaType="java.sql.ResultSet".
>     jdbcType=/<REFCURSOR>/, mode=OUT, resultMap=product#
>                                                              =
>     ProcName(#runtimeCode, jdbcType=INTEGER, mode=OUT#
>
>     ,#id#) }
>     </procedure>
>
>
>     Amit
>
>     Jeff Butler wrote:
>     > DB2 doesn't implement the idea of a ref cursor.  What feature of
>     DB2
>     > are you trying to use?
>     >
>     > Jeff Butler
>     >
>     >
>     >
>     > On 2/13/07, *Amit Kushwaha* <bluenex@googlemail.com
>     <ma...@googlemail.com>
>     > <mailto: bluenex@googlemail.com
>     <ma...@googlemail.com>>> wrote:
>     >
>     >     Hi,
>     >
>     >     Just checking,
>     >    
>     http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions
>     <http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions>
>     >
>     >     What if the database is DB2? Are DB2 versions of ref cursor's
>     >     supported?
>     >
>     >     Regards,
>     >
>     >     Amit
>     >
>     >
>     >
>
>


Re: REF CURSOR - DB2

Posted by Jeff Butler <je...@gmail.com>.
When DB2 returns a result set from a stored proc, it is not as an output
parameter.  It's just like the result set returned from a select statement.
So you don't declre an out parameter for the result set, you just use a
result map.

<procedure id="statementName" parameterClass="long", resultMap="product">
    { call ProcName(#id#) }
</procedure>


Jeff Butler



On 2/13/07, Amit Kushwaha <bl...@googlemail.com> wrote:
>
> Jeff,
>
> Right. DB2 stored procs, that returns back a result set.
>
> Do you need to specify the jdbcType on the output parameter that is a
> resultset?
>
> For ex, in the /<REFCURSOR> /below,
>
> <resultMap id="product" class="Product">
>    <result property="name"  columnIndex="1"/>
>    <result property="description"  columnIndex="2"/>
> </resultMap>
>
>
> <procedure id="statementName" parameterClass="long">
>     { call #output, javaType="java.sql.ResultSet".
> jdbcType=/<REFCURSOR>/, mode=OUT, resultMap=product#
>                                                          =
> ProcName(#runtimeCode, jdbcType=INTEGER, mode=OUT#
>
> ,#id#) }
> </procedure>
>
>
> Amit
>
> Jeff Butler wrote:
> > DB2 doesn't implement the idea of a ref cursor.  What feature of DB2
> > are you trying to use?
> >
> > Jeff Butler
> >
> >
> >
> > On 2/13/07, *Amit Kushwaha* <bluenex@googlemail.com
> > <ma...@googlemail.com>> wrote:
> >
> >     Hi,
> >
> >     Just checking,
> >
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions
> >
> >     What if the database is DB2? Are DB2 versions of ref cursor's
> >     supported?
> >
> >     Regards,
> >
> >     Amit
> >
> >
> >
>
>

Re: REF CURSOR - DB2

Posted by Amit Kushwaha <bl...@googlemail.com>.
Jeff,

Right. DB2 stored procs, that returns back a result set.

Do you need to specify the jdbcType on the output parameter that is a 
resultset?

For ex, in the /<REFCURSOR> /below,

  <resultMap id="product" class="Product">
    <result property="name"  columnIndex="1"/>
    <result property="description"  columnIndex="2"/>
  </resultMap>


  <procedure id="statementName" parameterClass="long">
     { call #output, javaType="java.sql.ResultSet". 
jdbcType=/<REFCURSOR>/, mode=OUT, resultMap=product#
                                                          =  
ProcName(#runtimeCode, jdbcType=INTEGER, mode=OUT#
                                                                              
,#id#) }
  </procedure>


Amit

Jeff Butler wrote:
> DB2 doesn't implement the idea of a ref cursor.  What feature of DB2 
> are you trying to use?
>  
> Jeff Butler
>
>
>  
> On 2/13/07, *Amit Kushwaha* <bluenex@googlemail.com 
> <ma...@googlemail.com>> wrote:
>
>     Hi,
>
>     Just checking,
>     http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions
>
>     What if the database is DB2? Are DB2 versions of ref cursor's
>     supported?
>
>     Regards,
>
>     Amit
>
>
>


Re: REF CURSOR - DB2

Posted by Jeff Butler <je...@gmail.com>.
DB2 doesn't implement the idea of a ref cursor.  What feature of DB2 are you
trying to use?

Jeff Butler



On 2/13/07, Amit Kushwaha <bl...@googlemail.com> wrote:
>
> Hi,
>
> Just checking,
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions
>
> What if the database is DB2? Are DB2 versions of ref cursor's supported?
>
> Regards,
>
> Amit
>
>
>