DB2 resultSet closed error - resultSetHoldability for apache BasicDataSource -
i need in configuring custom property "resultsetholdability" apache commons data source similar configuration available ibm websphere resolving db2 error - "invalid operation: result set closed".
connection established through jndi mapping actual ear deployed in ibm websphere. junit purpose, using apache basicdatasource configuration. please advise if other workaround available.
issue happens while doing resultset row mapping operation in while loop condition after invoking values through stored procedure select operation . had same issue got resolved ibm websphere(for deployed ear) after setting custom property datasource unable find similar workaround apache commons basicdatasource configuration used junit testing purpose.
below stacktrace:
caused by: com.ibm.db2.jcc.am.sqlexception: [jcc][t4][10120][10898][4.14.146] invalid operation: result set closed. errorcode=-4470, sqlstate=null @ com.ibm.db2.jcc.am.ed.a(ed.java:661) @ com.ibm.db2.jcc.am.ed.a(ed.java:60) @ com.ibm.db2.jcc.am.ed.a(ed.java:103) @ com.ibm.db2.jcc.am.resultset.checkforclosedresultset(resultset.java:4599) @ com.ibm.db2.jcc.am.resultset.nextx(resultset.java:330) @ com.ibm.db2.jcc.am.resultset.next(resultset.java:309) @ **org.apache.commons.dbcp.delegatingresultset.next(delegatingresultset.java:169) @ org.springframework.jdbc.core.rowmapperresultsetextractor.extractdata(rowmapperresultsetextractor.java:91)** @ org.springframework.jdbc.core.jdbctemplate.processresultset(jdbctemplate.java:1213) @ org.springframework.jdbc.core.jdbctemplate.extractreturnedresults(jdbctemplate.java:1104) @ org.springframework.jdbc.core.jdbctemplate$6.doincallablestatement(jdbctemplate.java:1076) @ org.springframework.jdbc.core.jdbctemplate$6.doincallablestatement(jdbctemplate.java:1066) @ org.springframework.jdbc.core.jdbctemplate.execute(jdbctemplate.java:1016)
xml configuration:
<bean id="objds" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="com.ibm.db2.jcc.db2driver" /> <property name="url" value="jdbc:db2://server" /> <property name="username" value="xxx" /> <property name="password" value="xxxxxx" /> </bean>
pom.xml configuration:
<dependency> <groupid>com.ibm.db2</groupid> <artifactid>db2jcc4</artifactid> <version>9.7</version> </dependency> <dependency> <groupid>commons-dbcp</groupid> <artifactid>commons-dbcp</artifactid> <version>1.2.2</version> </dependency>
java layer code:
public set<datainfo> executelistproc(string abc,string xyz) { setdatasource(getthedatasource()); setsql(get_list); declareparameter(new sqlreturnresultset(result, new getlistrowmapper())); declareparameter(new sqlparameter(s_param,types.varchar)); declareparameter(new sqlparameter(d_name_param,types.varchar)); compile(); map<string,object> parammap = new hashmap<string, object>(); parammap.put(s_param, state); parammap.put(d_name_param, drugname); execute(parammap); // row mapping operation performed after line execution return dlist; // error occurs after executing line }
Comments
Post a Comment