• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using an array for the life of a session

 
Shrikanth Goloposwami
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a small problem. I currently have a web app that queries
a database and returns the result over subsequent pages; one can page through the results with the familar "next" and "previous" links. Clicking on "next" or "previous" re-queries the database
and loops though results (which are in an array) depending on the page needed.
My problem is performance. It would be better to keep the array for each session; this would allow for the query to run once and all other pages would simply reuse the result array, which I would help performance.
Unfortunatly, I don't have JDBC2.0 to work with; features such as cached resultset is not something at my disposal.
Any thoughts?
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is this a Java page? If yes, why can't you use JDBC2.0?
 
Shrikanth Goloposwami
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Alex for your reply,
This app is one lonely little servlet. The reason I can't use JDBC2.0 is that our Oracle server isn't able to use JDBC2.0, yet.
So until then, I am stuck with work-arounds.
How might you resolve this problem using the result array within a session; is this possible?
Shri
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not create a Session object and add the array to that?
I have a question... why are the results in an array? It sounds as if you have 2,000 rows returned and are showing 50 on a page but you are reading all 2,000 rows into an array. This is probably where your inefficiencies are. Why not only get from the ResultSet the rows that you intend on displaying?
 
Shrikanth Goloposwami
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,
Now that I had some time with this, I have been playing with your idea of placing the array in the HttpSession object and this seems to be what I needed. However, your suggestion on only placing the results necessary for the page to be viewed is something that sounds great; but I don't have the ability to do this with standard sql. This sounds like something which could be done using JDBC2.0 with its methods handling scrollable results sets and such.
What's your take on this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic