Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to store ResultSet in List

843854Dec 7 2003 — edited Nov 20 2014
Hi all,
I have been searching forums for few hours to get information on this but could not get all the information required so posting this.

I am using JSP to connect to Oracle. I get resultset.next() to get the values and print them out. But now I want to show only limited records say 20 on one page and then previous and next links will show the next records. For this, by searching the forums I have come to realise that it can be done if i store the resultset in any list and pass to the session and then retrieve from the session for the next page and so on.

My problem is that I have not used any lists. Here is the code of my JSP which gets me records. Please help me how to store all this in list/linked list cos one row contains so many columns in my database and how do i retrieve all the field/column value one by one after i have stored.
String Query = "SELECT * FROM aSuppliers WHERE STATUS IS NULL";

ResultSet SQLResult = SQLStatement.executeQuery(Query);
while(SQLResult.next()){
	aID = SQLResult.getString("ID");
	aName = SQLResult.getString("name");
	aAddress = SQLResult.getString("address");
	aTel = SQLResult.getString("tel");
	aFax = SQLResult.getString("fax");
}
how do i save all this in list and on next page when i get the list, how do i fetch each string for each row from the list? Please Help.
Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 27 2007
Added on Dec 7 2003
19 comments
2,120 views