|
Can someone tell me why I get records left locked on the iSeries when I execute the following code? I thought I was cleaning up all the connections properly, but now I'm not so sure. The garbschedmstTable doesn't get the lock just garbscheddtlTable gets lock. Here's the code: if (req.getParameter("garbageId") != null && !req.getParameter("garbageId").equals( "")) { String garbageId = req.getParameter( "garbageId"); //add code to connect to the bulk garbage files and extract the data getGarbageMaster = conn.prepareStatement( "SELECT * FROM " + collectionName + dmd.getCatalogSeparator() + garbschedmstTable + " WHERE WGSCHDID = '" + garbageId.trim() + "'"); rs1 = getGarbageMaster.executeQuery(); BulkGarbageSchedMaster b = new BulkGarbageSchedMaster(); if (rs1.next()) { b.setGarbageRecExist(true); b.setGarbageId(rs1.getString( "WGSCHDID")); b.setCustId(rs1.getString( "WGCUSTID")); b.setgType((rs1.getString( "WGSCHDID").substring(0, 1))); b.setCallRecDate(rs1.getInt( "WGCALLDT")); b.setCallRecDateString(rs1.getInt( "WGCALLDT")); b.setCallRecTime(rs1.getString( "WGCALLTM")); b.setSchedPickUpDate(rs1.getInt( "WGSPICKD")); b.setOverrideSchedPickUpDate(rs1.getString("WGOVRIDE")); b.setOriginalPickUpDate(rs1.getInt("WGSPICKD")); b.setAppointmentCount(rs1.getInt( "WGAPPCNT")); b.setOriginalAppointmentCount(rs1.getInt("WGAPPCNT")); b.setAppointmentNumber(rs1.getInt( "WGAPPNUM")); b.setOriginalAppointmentNumber(rs1.getInt("WGAPPNUM")); b.setStatus(rs1.getString( "WGSTATUS")); b.setStatusReasonCode(rs1.getString("WGSTREAS")); b.setPaymentWaived(rs1.getString( "WGPYWAIVD")); b.setComments(rs1.getString( "WGCOMMENT")); b.setPaymentAmount(rs1.getDouble( "WGPAYAMNT")); b.setContractorId(rs1.getString( "WGCONTRID")); b.setDateSentToContractor(rs1.getInt("WGSDATE")); b.setDateRecFromContractor(rs1.getInt("WGRDATE")); b.setXCoOrd(rs1.getString( "WGXCOORD")); b.setYCoOrd(rs1.getString( "WGYCOORD")); b.setUserId(rs1.getString( "WGUSERID")); b.setSpare30a(rs1.getString( "WGSP30A")); b.setSpare20a(rs1.getString( "WGSP20A")); b.setSpare10a(rs1.getString( "WGSP10A")); b.setSpare05a(rs1.getString( "WGSP05A")); b.setSpare01a(rs1.getString( "WGSP01A")); b.setSpare92s(rs1.getDouble( "WGSP92S")); b.setSpare72s(rs1.getDouble( "WGSP72S")); b.setSpare52s(rs1.getDouble( "WGSP52S")); b.setSpare90s(rs1.getInt("WGSP90S" )); b.setSpare70s(rs1.getInt("WGSP70S" )); b.setSpare50s(rs1.getInt("WGSP50S" )); b.setSpare30s(rs1.getInt("WGSP30S" )); b.setSpare10s(rs1.getInt("WGSP10S" )); b.setPickupSchedule( customer.getGarbageArea(), customer.getStreetNo(), ds, "PUBWRK", "WPUSCHEDLE"); getGarbageDetail = conn.prepareStatement( "SELECT * FROM " + collectionName + dmd.getCatalogSeparator() + garbscheddtlTable + " WHERE WGDSCHID = '" + rs1.getString("WGSCHDID") + "'"); rs2 = getGarbageDetail.executeQuery(); while (rs2.next()) { b.setGarbageDetail( rs2.getString( "WGDSCHID"), rs2.getString( "WGDDESCID"), rs2.getString( "WGDIDESC"), rs2.getString( "WGDSP30A"), rs2.getString( "WGDSP20A"), rs2.getString( "WGDSP10A"), rs2.getString( "WGDSP05A"), rs2.getString( "WGDSP01A"), rs2.getDouble( "WGDSP92S"), rs2.getDouble( "WGDSP72S"), rs2.getDouble( "WGDSP52S"), rs2.getInt( "WGDSP90S"), rs2.getInt( "WGDSP70S"), rs2.getInt( "WGDSP50S"), rs2.getInt( "WGDSP30S"), rs2.getInt( "WGDSP10S")); } if (getGarbageDetail != null) { getGarbageDetail.close(); rs2.close(); } } if (getGarbageMaster != null) { getGarbageMaster.close(); rs1.close(); } conn.close(); Vector p = b.getPickupSchedule(); Integer iBulkPickUpIndex = new Integer(0); for (int i = 0; i < p.size(); i++) { PickUpSchedule pus = (PickUpSchedule) p.get(i); if (b.getSchedPickUpDate() == pus.getPickupDate()) { iBulkPickUpIndex = new Integer(i); } } if (b.getgType().equals("B")) { req.setAttribute("type", "bulk"); } else { req.setAttribute("type", "metal"); } sess.setAttribute("iBulkPickUpIndex", iBulkPickUpIndex); sess.setAttribute("iMetalPickUpIndex", iBulkPickUpIndex); sess.setAttribute("bBulkGarbage", b); sess.setAttribute("bMetalGarbage", b); sess.setAttribute("gdisabled", "disabled" ); sess.setAttribute("genabled", "enabled"); getServletConfig() .getServletContext() .getRequestDispatcher( "schedule_middle_detail.jsp") .forward(req, resp); } else { Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.