Please tell me if there is a size limitation for ResultSet
Hi,
I have a sql select * from....and the following code. If I limit the rows from the query results(rows 1 to 500), there is no problem. But if I get all the query results once , the ResultSet line get error message OutOfMemoryError. (I have large html infor. in the query result).
So my question is if there is a size limitation for ResultSet? Do I have to break down the query results?
PreparedStatement st = conn.prepareStatement(sql.toString());
ResultSet rs = st.executeQuery();
Thanks in advance,
Katie
[552 byte] By [
katieqa] at [2007-11-26 20:00:25]

[url= http://download-east.oracle.com/docs/cd/A97335_02/apps.102/a83724/resltse2.htm]check me[/url]
Hi,Thanks for the link, but I didn't see any answers for my question.....my question is if there is a way that ResultSet hold all the query results?Thanks again,Katie
> Hi,
>
> Thanks for the link, but I didn't see any answers for
> my question.....my question is if there is a way that
> ResultSet hold all the query results?
>
> Thanks again,
> Katie
Did you read this part:
" Result Set Limitations and Downgrade Rules
Some types of result sets are not feasible for certain kinds of queries. If you specify an unfeasible result set type or concurrency type for the query you execute, the JDBC driver follows a set of rules to determine the best feasible types to use instead.
The actual result set type and concurrency type are determined when the statement is executed, with the driver issuing a SQLWarning on the statement object if the desired result set type or concurrency type is not feasible. The SQLWarning object will contain the reason why the requested type was not feasible. Check for warnings to verify whether you received the type of result set that you requested, or call the methods described in "Verifying Result Set Type and Concurrency Type".
"
- There was a part after that that also talked about work arounds.
Hi,
Great, now I feel like some of the contestants from the show "are you smarter than the 5th grader"? I just can't connect the document to my case here now. For example, the following is not true in my case
* A query can select from only a single table and cannot contain any join operations.
(I use IBConsole, not Oracle, if it has something to do with it)
Could someone please tell me how to hold a large of infor (with html) in ResultSet?
Thanks,
Katie
> Hi,
> I have a sql select * from....and the following code.
> If I limit the rows from the query results(rows 1 to
> 500), there is no problem. But if I get all the
> query results once , the ResultSet line get error
> message OutOfMemoryError. (I have large html infor.
> in the query result).
>
> o my question is if there is a size limitation for
> ResultSet? Do I have to break down the query
> results?
There is a limit for absolutely everything in computers.
You could simply be running out of memory in terms of the application. There is a command line option that increases the maximum limit for the application. See '-Xmxn ' in the following...
http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
Hi,
Someone told me the PreparedStatement & ResultSet (the first two lines below) are always able to handle the query results (even is huge) from the select... statement (no OutOfMemoryError), the line that has some affects on the Memory is the list.add(profile); which will add each object to the RAM. Is it true?
PreparedStatement st = conn.prepareStatement(sql.toString());
ResultSet rs = st.executeQuery();
Profile = null;
while (rs.next()) {
profile = new Profile();
profile.setAgentID(rs.getInt(1));
profile.setOrderID(rs.getInt(2));
......
......
list.add(profile);
}
st.close();
rs.close();
> Hi,
>
> Someone told me the PreparedStatement & ResultSet
> (the first two lines below) are always able to handle
> the query results (even is huge) from the select...
> statement (no OutOfMemoryError), the line that has
> some affects on the Memory is the list.add(profile);
> which will add each object to the RAM. Is it true?
They were wrong or you did not understand them or the context was not clear.
You can have a result that returns a single row and based on the app, VM, OS and data the app will fail and there will be absolutely no way to fix it.
The reason I keep asking you guys on this is I was planning to run the sql once (results could be very big) and process each result one by one.... the good thing about this is I don't have to keep running the sql many times (rows 1 to 500) because each time querying it, it takes time.....
The project works fine if I rows 1 to 500, but it is just slow since after the first 500 get processed, then the program has to query the whole list again and get the next 500... so is it the only option I have here?
Thanks again,
Katie
> The reason I keep asking you guys on this is I was
> planning to run the sql once (results could be very
> big) and process each result one by one.... the good
> thing about this is I don't have to keep running the
> sql many times (rows 1 to 500) because each time
> querying it, it takes time.....
>
> The project works fine if I rows 1 to 500, but it is
> just slow since after the first 500 get processed,
> then the program has to query the whole list again
> and get the next 500... so is it the only option I
> have here?
>
That really isn't enough information.
You can certainly process a million rows if you want depending on the situation. But there are constraints on doing that. For one thing if you create 2000 bytes for each record you are not going to be able to keep all of the results in memory, you will need to write the results incrementally to the file system as you go.