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 Eugene Dvorkin <Eu...@artstor.org> on 2008/05/16 16:29:40 UTC
Exhausted resultset exception when use Oracle REF cursor type as output parameter from Stored Procedure
Hi,
We developed application with Spring, Hibernate and Ibatis.
We use Oracle Application Server and configured database Connection Pool
provided by Application Server.
Then we start stress test our application and discovered problem that
appears only under load and only in a call to
Stored Procedures than returns REF Cursor.
Caused by:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in org/artstor/pojo/CategoryThumbnail.xml.
--- The error occurred while applying a result map.
--- Check the CategoryThumbnail.result.
--- Check the result mapping for the 'thumbnailImgUrl' property.
--- Cause: java.sql.SQLException: Exhausted Resultset
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:185)
when we use plain select statement, it works fine. The way we call
stored procedures is:
<parameterMap id="searchCategoryParameters" class="map">
<parameter property="o" javaType="java.sql.ResultSet"
jdbcType="ORACLECURSOR" mode="OUT" resultMap="searchResult" />
<parameter property="keywords" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
<parameter property="objTypeId" jdbcType="NUMBER" javaType="int"
mode="IN" resultMap="searchResult"/>
<parameter property="orderBy" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
<parameter property="outLength" jdbcType="NUMBER" javaType="int"
mode="IN" resultMap="searchResult"/>
<parameter property="categoryId" jdbcType="NUMBER"
javaType="long" mode="IN" resultMap="searchResult"/>
<parameter property="thumbnailOnly" jdbcType="NUMBER"
javaType="int" mode="IN" resultMap="searchResult"/>
<parameter property="start_pos_in" jdbcType="NUMBER"
javaType="int" mode="IN" resultMap="searchResult"/>
<parameter property="page_length_in" jdbcType="NUMBER"
javaType="int" mode="IN" resultMap="searchResult"/>
</parameterMap>
<procedure id="searchAllCollection " parameterMap="searchParameters">
{?=call pkg_object_adv_search_new.do_search_v3
(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
</procedure>
In java :
HashMap<Object, Object> parameters = new HashMap<Object, Object>();
SqlMapClientTemplate client = getSqlMapClientTemplate();
.
.
client.queryForList("searchAllCollections ",
parameters);
result = (List) parameters.get("o");
Stored Procedure declaration:
FUNCTION search_collections (
keyword_words_in IN VARCHAR2,
obj_type_id_in IN NUMBER,
order_by_in IN VARCHAR2 DEFAULT ' sco1 desc, sco2 desc',
outlength_in IN NUMBER DEFAULT 501,
collection_ids_in IN VARCHAR2,
thumbnail_only_in IN BOOLEAN
)
RETURN pkg_object_search_cursor.return_cur;
Where return type is
TYPE object_cur IS REF CURSOR
When we accessing result from stored procedure, we got problem.
Please help
Sincerely,
eugene
RE: Exhausted resultset exception when use Oracle REF cursor type as output parameter from Stored Procedure
Posted by Jesse Reimann <jr...@ctigroup.com>.
I've previously been told when I was asking about Oracle REF Cursors
that I should be using "update" instead of "queryForList". Technically
"queryForList" doesn't fully work correctly with REF Cursors since the
return list isn't being populated even though the map passed into
"queryForList" does seem to get populated.
Maybe you can give try switching to using "update" and see if the
problems still arise.
Thanks,
Jesse
-----Original Message-----
From: Eugene Dvorkin [mailto:Eugene.Dvorkin@artstor.org]
Sent: Friday, May 16, 2008 10:30 AM
To: user-java@ibatis.apache.org
Subject: Exhausted resultset exception when use Oracle REF cursor type
as output parameter from Stored Procedure
Hi,
We developed application with Spring, Hibernate and Ibatis.
We use Oracle Application Server and configured database Connection Pool
provided by Application Server.
Then we start stress test our application and discovered problem that
appears only under load and only in a call to
Stored Procedures than returns REF Cursor.
Caused by:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in org/artstor/pojo/CategoryThumbnail.xml.
--- The error occurred while applying a result map.
--- Check the CategoryThumbnail.result.
--- Check the result mapping for the 'thumbnailImgUrl' property.
--- Cause: java.sql.SQLException: Exhausted Resultset
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:185)
when we use plain select statement, it works fine. The way we call
stored procedures is:
<parameterMap id="searchCategoryParameters" class="map">
<parameter property="o" javaType="java.sql.ResultSet"
jdbcType="ORACLECURSOR" mode="OUT" resultMap="searchResult" />
<parameter property="keywords" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
<parameter property="objTypeId" jdbcType="NUMBER" javaType="int"
mode="IN" resultMap="searchResult"/>
<parameter property="orderBy" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
<parameter property="outLength" jdbcType="NUMBER" javaType="int"
mode="IN" resultMap="searchResult"/>
<parameter property="categoryId" jdbcType="NUMBER"
javaType="long" mode="IN" resultMap="searchResult"/>
<parameter property="thumbnailOnly" jdbcType="NUMBER"
javaType="int" mode="IN" resultMap="searchResult"/>
<parameter property="start_pos_in" jdbcType="NUMBER"
javaType="int" mode="IN" resultMap="searchResult"/>
<parameter property="page_length_in" jdbcType="NUMBER"
javaType="int" mode="IN" resultMap="searchResult"/>
</parameterMap>
<procedure id="searchAllCollection " parameterMap="searchParameters">
{?=call pkg_object_adv_search_new.do_search_v3
(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
</procedure>
In java :
HashMap<Object, Object> parameters = new HashMap<Object, Object>();
SqlMapClientTemplate client = getSqlMapClientTemplate();
.
.
client.queryForList("searchAllCollections ",
parameters);
result = (List) parameters.get("o");
Stored Procedure declaration:
FUNCTION search_collections (
keyword_words_in IN VARCHAR2,
obj_type_id_in IN NUMBER,
order_by_in IN VARCHAR2 DEFAULT ' sco1 desc, sco2 desc',
outlength_in IN NUMBER DEFAULT 501,
collection_ids_in IN VARCHAR2,
thumbnail_only_in IN BOOLEAN
)
RETURN pkg_object_search_cursor.return_cur;
Where return type is
TYPE object_cur IS REF CURSOR
When we accessing result from stored procedure, we got problem.
Please help
Sincerely,
eugene
RE: Exhausted resultset exception when use Oracle REF cursor type as output parameter from Stored Procedure
Posted by Eugene Dvorkin <Eu...@artstor.org>.
I think we have all parameters map actually. I just cut some to make
post a little shorter.
the code is working fine, but only up to 30 or so users doing stress
testing.
From: BalaKishore Pamarti [mailto:bpamarti@yahoo.com]
Sent: Friday, May 16, 2008 12:21 PM
To: user-java@ibatis.apache.org
Subject: Re: Exhausted resultset exception when use Oracle REF cursor
type as output parameter from Stored Procedure
At the first glance I noticed these --
You dont have to sepicify resultMap for all the IN parameters in
parameterMap element.
Your listed parameters in the parameterMap element are 9 and your ?'s in
the procedure call are 14. think this should be 8
There is not match for ur parameters specified in the stored procedure
to those in parameterMap element.
post the right code.
Eugene Dvorkin <Eu...@artstor.org> wrote:
Hi,
We developed application with Spring, Hibernate and Ibatis.
We use Oracle Application Server and configured database
Connection Pool
provided by Application Server.
Then we start stress test our application and discovered problem
that
appears only under load and only in a call to
Stored Procedures than returns REF Cursor.
Caused by:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
org/artstor/pojo/CategoryThumbnail.xml.
--- The error occurred while applying a result map.
--- Check the CategoryThumbnail.result.
--- Check the result mapping for the 'thumbnailImgUrl' property.
--- Cause: java.sql.SQLException: Exhausted Resultset
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:185)
when we use plain select statement, it works fine. The way we
call
stored procedures is:
jdbcType="ORACLECURSOR" mode="OUT" resultMap="searchResult" />
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
mode="IN" resultMap="searchResult"/>
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
mode="IN" resultMap="searchResult"/>
javaType="long" mode="IN" resultMap="searchResult"/>
javaType="int" mode="IN" resultMap="searchResult"/>
javaType="int" mode="IN" resultMap="searchResult"/>
javaType="int" mode="IN" resultMap="searchResult"/>
{?=call pkg_object_adv_search_new.do_search_v3
(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
In java :
HashMap parameters = new HashMap();
SqlMapClientTemplate client = getSqlMapClientTemplate();
.
.
client.queryForList("searchAllCollections ",
parameters);
result = (List) parameters.get("o");
Stored Procedure declaration:
FUNCTION search_collections (
keyword_words_in IN VARCHAR2,
obj_type_id_in IN NUMBER,
order_by_in IN VARCHAR2 DEFAULT ' sco1 desc, sco2 desc',
outlength_in IN NUMBER DEFAULT 501,
collection_ids_in IN VARCHAR2,
thumbnail_only_in IN BOOLEAN
)
RETURN pkg_object_search_cursor.return_cur;
Where return type is
TYPE object_cur IS REF CURSOR
When we accessing result from stored procedure, we got problem.
Please help
Sincerely,
eugene
"Peace is found not in what surrounds us, but in what we hold within."
Re: Exhausted resultset exception when use Oracle REF cursor type as output parameter from Stored Procedure
Posted by BalaKishore Pamarti <bp...@yahoo.com>.
At the first glance I noticed these --
You dont have to sepicify resultMap for all the IN parameters in parameterMap element.
Your listed parameters in the parameterMap element are 9 and your ?'s in the procedure call are 14. think this should be 8
There is not match for ur parameters specified in the stored procedure to those in parameterMap element.
post the right code.
Eugene Dvorkin <Eu...@artstor.org> wrote:
Hi,
We developed application with Spring, Hibernate and Ibatis.
We use Oracle Application Server and configured database Connection Pool
provided by Application Server.
Then we start stress test our application and discovered problem that
appears only under load and only in a call to
Stored Procedures than returns REF Cursor.
Caused by:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in org/artstor/pojo/CategoryThumbnail.xml.
--- The error occurred while applying a result map.
--- Check the CategoryThumbnail.result.
--- Check the result mapping for the 'thumbnailImgUrl' property.
--- Cause: java.sql.SQLException: Exhausted Resultset
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:185)
when we use plain select statement, it works fine. The way we call
stored procedures is:
jdbcType="ORACLECURSOR" mode="OUT" resultMap="searchResult" />
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
mode="IN" resultMap="searchResult"/>
javaType="java.lang.String" mode="IN" resultMap="searchResult"/>
mode="IN" resultMap="searchResult"/>
javaType="long" mode="IN" resultMap="searchResult"/>
javaType="int" mode="IN" resultMap="searchResult"/>
javaType="int" mode="IN" resultMap="searchResult"/>
javaType="int" mode="IN" resultMap="searchResult"/>
{?=call pkg_object_adv_search_new.do_search_v3
(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
In java :
HashMap parameters = new HashMap();
SqlMapClientTemplate client = getSqlMapClientTemplate();
.
.
client.queryForList("searchAllCollections ",
parameters);
result = (List) parameters.get("o");
Stored Procedure declaration:
FUNCTION search_collections (
keyword_words_in IN VARCHAR2,
obj_type_id_in IN NUMBER,
order_by_in IN VARCHAR2 DEFAULT ' sco1 desc, sco2 desc',
outlength_in IN NUMBER DEFAULT 501,
collection_ids_in IN VARCHAR2,
thumbnail_only_in IN BOOLEAN
)
RETURN pkg_object_search_cursor.return_cur;
Where return type is
TYPE object_cur IS REF CURSOR
When we accessing result from stored procedure, we got problem.
Please help
Sincerely,
eugene
"Peace is found not in what surrounds us, but in what we hold within."