I am migrating the application from Websphere Application Server 6 to Websphere Application Server 7.
During which I am facing the following Issue:
ResultSet rs=cstmt.executeQuery(); working in WAS6 but not in WAS7
Error is : com.ibm.db2.jcc.c.SqlException: java.sql.CallableStatement.executeQuery() was called but no result set was returned. Use java.sql.CallableStatement.executeUpdate() for non-queries.
Since it is returning resultset that is the prob we can not do the action that is suggested by the error.
If it would not have returning anythng then we could have used cstmt.executeUpdate().
Code Overview:
Connection conn = null; CallableStatement cstmt = null; ResultSet rs =null; Result rsFilter = null; before = System.currentTimeMillis(); String sqlstr="{call wdssappl_stp.get_Template(?,?,?,?,?,?,?,?,?,?)}"; try { conn = sl.getWdss_Connection(); // get this from common service locator cstmt=conn.prepareCall(sqlstr); cstmt.setString(1,"A"); if(filter==null){cstmt.setNull(2,Types.VARCHAR);} else {cstmt.setString(2,filter);} cstmt.setInt(3,iStartIdx); cstmt.setInt(4,iEndIdx); cstmt.setInt(5,iRoleId); cstmt.setString(6,tid); cstmt.registerOutParameter(7,Types.INTEGER); cstmt.registerOutParameter(8,Types.INTEGER); cstmt.registerOutParameter(9,Types.INTEGER); cstmt.registerOutParameter(10,Types.VARCHAR); System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); rs=cstmt.executeQuery(); rsFilter=ResultSupport.toResult(rs); after = System.currentTimeMillis();
Can anyone suggest what should be done for that ???
Thanks in Advance.