[Pljava-dev] [SPAM] Re: Pljava\-dev Digest, Vol 26, Issue 8

Marek Lewczuk marek at lewczuk.com
Wed Apr 19 09:24:54 UTC 2006


lifeng napisał(a):
> pljava-dev-request,hi!
> 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.

Well, result is a ResultSet of the main query:
		
		Connection connection = 
DriverManager.getConnection("jdbc:default:connection");
		Statement statement = connection.createStatement();
		ResultSet result;
		statement.execute("...");
		result = statement.getResultSet();
		while (result.next()) {
		...
		}
		result.close();
		statement.close();

So as you can see it will be closed after last row.

 



More information about the Pljava-dev mailing list