db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Matrigali <mikem_...@sbcglobal.net>
Subject Re: SQLException: The heap container with container id Container(-1, 1157060695837) is closed.
Date Thu, 31 Aug 2006 23:28:52 GMT
are you in autocommit=true or not?
What does addLineItem do? ie. does it execute any queries?

This certainly has the feel of a resultset being closed in the middle by
some other statement.  Usually this is seen with autocommit=true and
"non held" cursors.
in the "next" loop there is a call to some other code that executes a
query and when that statement ends, it commits the transaction of the
calling select loop, closing the non-held cursors.

When such a situation occurs, it can be data dependent when the
error is encountered.  Depending on isolation level and query plans
a number of rows may be cached in memory before returning the 1st
row to the select loop.  If possible derby streams rows to the select
loop so that a normal situation is for there to be a number of results
waiting to be drained by the select loop, but also at some point the
act of draining another row may move the pipeline along causing raw
rows to be read from disk and processed to create the next "batch" of
rows for the select loop.

BALDWIN, ALAN J [AG-Contractor/1000] wrote:
> The weird thing with this is that it seems to be data dependent.  This 
> code has been in use (unchanged) for some time now, and has only today 
> started breaking with a specific dataset, which is around 60 rows joined 
> across 5-6 tables.
> 
>  
> 
> -Alan Baldwin-
> 
>  
> 
> -----Original Message-----
> *From:* BALDWIN, ALAN J [AG-Contractor/1000]
> *Sent:* Thursday, August 31, 2006 5:13 PM
> *To:* 'Derby Discussion'
> *Subject:* RE: SQLException: The heap container with container id 
> Container(-1, 1157060695837) is closed.
> 
>  
> 
> Michael,
> 
> Here is the java code block…
> 
>  
> 
> Neither the processTransactionResultSetRow() nor the 
> lineItemDao.processResultSetRow() methods close the resultset.  In fact, 
> they are included below.
> 
>  
> 
>  
> 
>       rs = ps.executeQuery();
> 
>  
> 
>       Map transactionSet = new HashMap();
> 
>       while (rs.next()) {                         //BOMBS HERE ON SECOND 
> LOOP
> 
>         Long id = new Long(rs.getLong("TransactionId"));
> 
>         DealerTransaction transaction = (DealerTransaction) 
> transactionSet.get(id);
> 
>         if (transaction == null) {
> 
>           transaction = processTransactionResultSetRow(rs);
> 
>           transactionSet.put(id, transaction);
> 
>           dealerTransactions.add(transaction);
> 
>         }
> 
>         transaction.addLineItem(lineItemDao.processResultSetRow(rs, 
> connection));
> 
>       }
> 
>     } finally {
> 
>       DBHelper.closeResources(ps, rs);
> 
>     }
> 
>  
> 
>  
> 
> =====================
> 
> private DealerTransaction processTransactionResultSetRow(ResultSet rs) 
> throws SQLException {
> 
>     DealerTransaction dealerTransaction = new 
> DealerTransaction(rs.getLong("TransactionId"),
> 
>         rs.getDate("TransactionDate"), rs.getInt("SeedYear"), 
> rs.getString("ShipToName"), rs.getString("ShipFromName"));
> 
>  
> 
>     dealerTransaction.setPoNumber(rs.getString("PONumber"));
> 
>     dealerTransaction.setBolNumber(rs.getInt("BillOfLadingNumber"));
> 
>     
> dealerTransaction.setTransactionToFrom(rs.getString("TransactionToFrom"));
> 
>     dealerTransaction.setSoldToId(rs.getString("SoldToID"));
> 
>     dealerTransaction.setSoldToIdType(rs.getString("SoldToIdType"));
> 
>     dealerTransaction.setPlantCode(rs.getString("PlantCode"));
> 
>     dealerTransaction.setPlantName(rs.getString("PlantName"));
> 
>     
> dealerTransaction.setTransactionNumber(rs.getString("TransactionNumber"));
> 
>     dealerTransaction.setShipToId(rs.getString("ShipToID"));
> 
>     dealerTransaction.setShipToIdType(rs.getString("ShipToIdType"));
> 
>     dealerTransaction.setSoldToName(rs.getString("SoldToName"));
> 
>  
> 
>     return dealerTransaction;
> 
>   }
> 
>  
> 
> ====================
> 
> DealerTransactionDetail processResultSetRow(ResultSet rs, Connection 
> connection) throws SQLException {
> 
>     Dealer affiliate = dealerDao.loadDealer(connection, 
> rs.getString("AffiliateIRDAccountId"));
> 
>     Product product = productDao.loadProduct(connection, 
> rs.getString("ProductUPC"), rs.getInt("SeedYear"));
> 
>  
> 
>     DealerTransactionDetail dealerTransactionDetail = new 
> DealerTransactionDetail(rs.getInt("ItemNumber"), rs
> 
>             .getInt("Quantity"), DBHelper.getYesNo(rs, "IsVoided"), 
> product, rs.getString("TransactionTypeName"), rs
> 
>             .getString("StatusName"), rs.getInt("SeedYear"));
> 
>  
> 
>     dealerTransactionDetail.setOriginalUnits(rs.getFloat("SapQuantity"));
> 
>     
> dealerTransactionDetail.setDamagedQuantity(rs.getFloat("DamagedQuantity"));
> 
>     dealerTransactionDetail.setLotNumber(rs.getString("LotNumber"));
> 
>     dealerTransactionDetail.setAffiliateDealer(affiliate);
> 
>     dealerTransactionDetail.setLocation(rs.getString("Location"));
> 
>     dealerTransactionDetail.setComment(rs.getString("DeliveryComment"));
> 
>     dealerTransactionDetail.setSeedSize(rs.getString("SeedSize"));
> 
>     dealerTransactionDetail.setUserDate(rs.getDate("UserDate"));
> 
>     dealerTransactionDetail.setProductSapId(rs.getLong("ProductSapId"));
> 
>     dealerTransactionDetail.setSapUom(rs.getString("SapUnitOfMeasure"));
> 
>     return dealerTransactionDetail;
> 
>   }
> 
>  
> 
> Thanks!
> 
>  
> 
> -Alan Baldwin-
> 
>  
> 
>  
> 
> -----Original Message-----
> *From:* Michael Segel [mailto:msegel@segel.com] *On Behalf Of 
> *derby@segel.com
> *Sent:* Thursday, August 31, 2006 5:05 PM
> *To:* 'Derby Discussion'
> *Subject:* RE: SQLException: The heap container with container id 
> Container(-1, 1157060695837) is closed.
> 
>  
> 
> Can you provide some code of the loop?
> 
> It sounds like you’re closing out the result set.
> 
> But hey! What do I know?
> 
>  
> 
> ------------------------------------------------------------------------
> 
> *From:* BALDWIN, ALAN J [AG-Contractor/1000] 
> [mailto:alan.j.baldwin@monsanto.com]
> *Sent:* Thursday, August 31, 2006 5:01 PM
> *To:* derby-user@db.apache.org
> *Subject:* SQLException: The heap container with container id 
> Container(-1, 1157060695837) is closed.
> 
>  
> 
> Hello all,
> 
> I'm running a query from java that throws the exception in the subject.  
> The code that fails is when calling rs.next() **on the second iteration 
> only**.  I can't seem to find anything on the web regarding this 
> error.   Could someone point me in the right direction?
> 
> Regards,
> 
> Alan Baldwin
> 
> //This e-mail message may contain privileged and/or confidential 
> information, and is intended to be received only by persons entitled to 
> receive such information. If you have received this e-mail in error, 
> please notify the sender immediately. Please delete it and all 
> attachments from any servers, hard drives or any other media. Other use 
> of this e-mail by you is strictly prohibited.//
> 
> //All e-mails and attachments sent and received are subject to 
> monitoring, reading and archival by Monsanto. The recipient of this 
> e-mail is solely responsible for checking for the presence of "Viruses" 
> or other "Malware". Monsanto accepts no liability for any damage caused 
> by any such code transmitted by or accompanying this e-mail or any 
> attachment.//
> 
> //This e-mail message may contain privileged and/or confidential 
> information, and is intended to be received only by persons entitled to 
> receive such information. If you have received this e-mail in error, 
> please notify the sender immediately. Please delete it and all 
> attachments from any servers, hard drives or any other media. Other use 
> of this e-mail by you is strictly prohibited.//
> 
> //All e-mails and attachments sent and received are subject to 
> monitoring, reading and archival by Monsanto. The recipient of this 
> e-mail is solely responsible for checking for the presence of "Viruses" 
> or other "Malware". Monsanto accepts no liability for any damage caused 
> by any such code transmitted by or accompanying this e-mail or any 
> attachment.//
> 
> /This e-mail message may contain privileged and/or confidential 
> information, and is intended to be received only by persons entitled to 
> receive such information. If you have received this e-mail in error, 
> please notify the sender immediately. Please delete it and all 
> attachments from any servers, hard drives or any other media. Other use 
> of this e-mail by you is strictly prohibited./
> 
> /All e-mails and attachments sent and received are subject to 
> monitoring, reading and archival by Monsanto. The recipient of this 
> e-mail is solely responsible for checking for the presence of "Viruses" 
> or other "Malware". Monsanto accepts no liability for any damage caused 
> by any such code transmitted by or accompanying this e-mail or any 
> attachment./
> 


Mime
View raw message