[Pljava-dev] Pljava-dev Digest, Vol 26, Issue 8

From: lifenggod at 263(dot)net (lifeng)
To:
Subject: [Pljava-dev] Pljava-dev Digest, Vol 26, Issue 8
Date: 2006-04-19 08:56:06
Message-ID: 20060419085615.E7DF3978C1@smtp.263.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

pljava-dev-request,hi?

Marek's source code:

> // insert into regional registrations table
> {
> Statement s = connection.createStatement();
>
> ResultSet r = s.executeQuery("SELECT oCarTypeId FROM
>samarapp_data.sapp_cda_pl_cep_rre WHERE oCarTypeId = " + co + " AND
>nCarTypeId = " + cn + " AND nMakeId = " + mk + " AND nModelId = " + mo +
>" AND nDistrictW = " + rw + " AND nDistrictP = " + rp + " AND
>productionYear = " + result.getInt("productionyear") + " AND
>registrationYear = " + result.getInt("registrationyear"));
>
> if (r.next() == false) s.execute("INSERT INTO
>samarapp_data.sapp_cda_pl_cep_rre (oCarTypeId, nCarTypeId, nMakeId,
>nModelId, nDistrictW, nDistrictP, productionYear, registrationYear,
>registrationMonth" + result.getInt("registrationmonth") + ") VALUES (" +
>co + "," + cn + "," + mk + "," + mo + "," + rw + "," + rp + "," +
>result.getInt("productionyear") + "," +
>result.getInt("registrationyear") + "," +
>result.getInt("registrationamount") + ")");
>
> else s.execute("UPDATE samarapp_data.sapp_cda_pl_cep_rre SET
>registrationMonth" + result.getInt("registrationmonth") + "=" +
>result.getInt("registrationamount") + " WHERE oCarTypeId = " + co + "
>AND nCarTypeId = " + cn + " AND nMakeId = " + mk + " AND nModelId = " +
>mo + " AND nDistrictW = " + rw + " AND nDistrictP = " + rp + " AND
>productionYear = " + result.getInt("productionyear") + " AND
>registrationYear = " + result.getInt("registrationyear"));
>
> r.close();
>
> s.close();
> }

When did the result close ? Marek, we can see two ResultSet("result" and "r")in your sourcecode .In the last code ,there is "r.close" to close ResultSet("r") explicitly but i cann't see where the "result" is closed . If you did not close the "result", i guess that it's the error to lead the memory leak.



????????lifeng
????????lifenggod at 263.net
??????????2006-04-19

Browse pljava-dev by date

  From Date Subject
Next Message Marek Lewczuk 2006-04-19 09:24:54 [Pljava-dev] [SPAM] Re: Pljava\-dev Digest, Vol 26, Issue 8
Previous Message Marek Lewczuk 2006-04-19 08:05:34 [Pljava-dev] out of memory