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 Satish Kumar <cs...@yahoo.com> on 2007/01/05 20:42:48 UTC

Handle to ResultSet

Hi,

I am a new user of iBATIS Ver 2.3.0. I have a requirement to get the handle to the ResultSet from iBATIS for post-processing.

The ResultSet is from a Oracle Ref Cursor returned by a stored procedure. I followed the examples mentioned on the iBATIS Wiki and mailing lists, but have not had success. 

I am using JDK 1.5, the latest version of Oracle 10g JDBC drivers.

Below is the SQLMap

<?xml version="1.0" encoding="UTF-8" ?>
http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap>
    <parameterMap id="listErrorParameters" class="java.util.Map">
        <parameter property="serverId" jdbcType="NUMERIC" mode="IN"/>
        <parameter property="resultSet" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
    </parameterMap>

    <procedure id="listError" parameterMap="listErrorParameters" >         
        {call listError(?,?)}
    </procedure>
</sqlMap>

Sample Program:

    public static main(String[] args) {
        try{
        String resource;
        Reader reader;

        SqlMapClient sqlMap;
        resource = "sqlMap-config.xml";
        reader = Resources.getResourceAsReader (resource);
        sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);

        Map paramsMap = new HashMap();
        paramsMap.put("id", "1000");

        sqlMap.queryForObject("listError", paramsMap);

        System.out.println("resultSet: " + paramsMap.get("resultSet"));

        }catch(Exception aoExec)
        {
            aoExec.printStackTrace();
        }
    }

In the above program paramsMap.get("resultSet") always returns null, and I am not sure why?

Any help would be greatly appreciated.

Thanks
Satish



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Handle to ResultSet

Posted by Jan Vissers <Ja...@cumquat.nl>.
Note sure whether you followed this Wiki entry:
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=5653


> Hi,
>
> I am a new user of iBATIS Ver 2.3.0. I have a requirement to get the
> handle to the ResultSet from iBATIS for post-processing.
>
> The ResultSet is from a Oracle Ref Cursor returned by a stored procedure.
> I followed the examples mentioned on the iBATIS Wiki and mailing lists,
> but have not had success.
>
> I am using JDK 1.5, the latest version of Oracle 10g JDBC drivers.
>
> Below is the SQLMap
>
> <?xml version="1.0" encoding="UTF-8" ?>
> http://ibatis.apache.org/dtd/sql-map-2.dtd">
>
> <sqlMap>
>     <parameterMap id="listErrorParameters" class="java.util.Map">
>         <parameter property="serverId" jdbcType="NUMERIC" mode="IN"/>
>         <parameter property="resultSet" javaType="java.sql.ResultSet"
> jdbcType="ORACLECURSOR" mode="OUT"/>
>     </parameterMap>
>
>     <procedure id="listError" parameterMap="listErrorParameters" >
>         {call listError(?,?)}
>     </procedure>
> </sqlMap>
>
> Sample Program:
>
>     public static main(String[] args) {
>         try{
>         String resource;
>         Reader reader;
>
>         SqlMapClient sqlMap;
>         resource = "sqlMap-config.xml";
>         reader = Resources.getResourceAsReader (resource);
>         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>
>         Map paramsMap = new HashMap();
>         paramsMap.put("id", "1000");
>
>         sqlMap.queryForObject("listError", paramsMap);
>
>         System.out.println("resultSet: " + paramsMap.get("resultSet"));
>
>         }catch(Exception aoExec)
>         {
>             aoExec.printStackTrace();
>         }
>     }
>
> In the above program paramsMap.get("resultSet") always returns null, and I
> am not sure why?
>
> Any help would be greatly appreciated.
>
> Thanks
> Satish
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com