java - Closed Resultset: next error in jsp page, after upgrading to ojdbc7.jar from ojdbc14.jar via myEclipse -


creating 2 result sets in java class below & when return jsp page, access below such & loop through result sets put data on page fields.

was working fine ojdbc14.jar, upgraded ojdbc7.jar (for oracle 12c) via myeclipse project. getting closed resultset: next error in jsp page when access first result set.

any ideas or suggestions please upgrade being done?

i know can use collections, etc., trying keep code same returned cursors result sets accessed in jsp page. assistance.

jsp page:

<% bcsdata vbcs =    (bcsdata)session.getattribute("com.sherwin.barcodeshipping.bcsdata"); %>  <table class="data" > <tr class="header">    <td class="datatxt"> order number    </td>     <td class="datatxt">  rex            </td>    <td class="datatxt">  size code      </td>    <td class="datatxt">  loc            </td>    <td class="datanbr">  total cartons  </td>    <td class="datanbr">  total pallets  </td>    <td class="datanbr">  total weight   </td>    <td class="datanbr"> total units     </td>     <td class="datanbr"> order units     </td>     <td class="datanbr"> order qty       </td>                     </tr> <%   while (vbcs.bolresultset.next())  {    %>  <tr class="body">     <td class="datatxt"><%= vbcs.bolresultset.getstring(1) %> </td>    <td class="datatxt"><%= vbcs.bolresultset.getstring(2) %> </td>    <td class="datatxt"><%= vbcs.bolresultset.getstring(3) %> </td>    <td class="datatxt"><%= vbcs.bolresultset.getstring(4) %> </td>    <td class="datanbr"><%= vbcs.bolresultset.getfloat(5) %>  </td>    <td class="datanbr"><%= vbcs.bolresultset.getfloat(6) %>  </td>    <td class="datanbr"><%= vbcs.bolresultset.getfloat(7) %>  </td>    <td class="datanbr"><%= vbcs.bolresultset.getfloat(8) %>  </td>    <td class="datanbr"><%= vbcs.bolresultset.getfloat(9) %>  </td>    <td class="datanbr"><%= vbcs.bolresultset.getfloat(10) %> </td>   </tr> <%                          } %> </table>  <hr class="innermed" >   <table class="data">    <tr class="header">        <td class="datatxt"> whs            </td>         <td class="datatxt"> customer       </td>        <td class="datatxt"> dock           </td>                   <td class="datanbr"> total pallets  </td>        <td class="datanbr"> total weight   </td>        <td class="datanbr"> total units    </td>                     </tr> <%     while (vbcs.bolsummaryresultset.next())    {    %>      <tr class="body">        <td class="datatxt"><%= vbcs.bolsummaryresultset.getstring(1)  %> </td>       <td class="datatxt"><%= vbcs.bolsummaryresultset.getstring(2)  %> </td>       <td class="datatxt"><%= vbcs.bolsummaryresultset.getstring(3)  %> </td>       <td class="datanbr"><%= vbcs.bolsummaryresultset.getfloat(4)   %> </td>       <td class="datanbr"><%= vbcs.bolsummaryresultset.getfloat(5)   %> </td>       <td class="datanbr"><%= vbcs.bolsummaryresultset.getfloat(6)   %> </td>           </tr> <%    } // while %> </table> 

java class result sets created , closed:

public resultset           bolresultset; public resultset           bolsummaryresultset;  public integer assigndock(string pdbsource, string ploginid) {    integer             vretcode; string              vretmsg; connection          vconnection = null; callablestatement   vcallstmt   = null;  try {             vconnection = dbconnection.getconnection(pdbsource, ploginid);     //system.out.println("bcsdata.java assigndock");     vcallstmt = vconnection.preparecall     ("begin ship_door_assignment_pkg.assign_dock (?,?, ?,?,?,?,?,?, ?,?,?,?,?,?, ?, ?,?,?,?); end;");      vcallstmt.setstring(1, plantcode);     vcallstmt.setstring(2, dock);     vcallstmt.setstring(3, p1.pallbl);     vcallstmt.setfloat(4,  p1.cartonqty);     vcallstmt.setfloat(5,  p1.palsize);     vcallstmt.setfloat(6,  p1.drumgallons);     vcallstmt.setfloat(7,  p1.drumgross);     vcallstmt.setfloat(8,  p1.drumtare);     vcallstmt.setstring(9, p2.pallbl);     vcallstmt.setfloat(10, p2.cartonqty);     vcallstmt.setfloat(11, p2.palsize);     vcallstmt.setfloat(12, p2.drumgallons);     vcallstmt.setfloat(13, p2.drumgross);     vcallstmt.setfloat(14, p2.drumtare);     vcallstmt.setstring(15, printer);     vcallstmt.registeroutparameter(16, oracletypes.number);     vcallstmt.registeroutparameter(17, oracletypes.varchar);     vcallstmt.registeroutparameter(18, oracletypes.cursor);        vcallstmt.registeroutparameter(19, oracletypes.cursor);       vcallstmt.execute();      vretcode  = vcallstmt.getint(16);     vretmsg   = vcallstmt.getstring(17);       if (vretcode == 0)     {                        bolsummaryresultset = (resultset)vcallstmt.getobject(18);         bolresultset = (resultset)vcallstmt.getobject(19);       }        else     {   errormsg = vretmsg;     }  } catch (sqlexception se) {     throw new runtimeexception(se); } {            dbconnection.closecallablestatement(vcallstmt);     dbconnection.closeconnection(vconnection); }         return vretcode;      }  //assigndock  

it's lifecycle problem. if close database connection, related result sets closed. (there no connection database anymore. don't ask me why worked before.)

so have change code such follows sequence:

  1. run stored procedure , retrieve cursor/result set
  2. execute jsp page
  3. close database connection

i couldn't find information if result set retrieved out parameter of stored procedure lives on after statement has been closed. think so. if not, need wait before close statement.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -