Two Laptop Bag*
The moose likes JDBC and the fly likes Searching a record in resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Searching a record in resultset" Watch "Searching a record in resultset" New topic
Author

Searching a record in resultset

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In a ResultSet can we search records from top to bottom and bottom to top at the same time and how. If so, is it faster than searching from one side.
Anjali Ajwani
Greenhorn

Joined: Jan 18, 2001
Posts: 16
Scrolling through result sets bi-directionally can be done with a JDBC 2.0 database driver, but cannot be done with a JDBC 1.x driver.
Anjali
Originally posted by bhupathiraju gayatridevi:
In a ResultSet can we search records from top to bottom and bottom to top at the same time and how. If so, is it faster than searching from one side.

Matts Smith
Ranch Hand

Joined: Feb 03, 2001
Posts: 113
It wouldn't be faster to scroll from both sides since the processing time would be the same (i.e. if you have 10 records to process then you have to loop through all 10 records one way or the other)
another point is that your code would be a mess if you scrolled from both sides.
the standard way to do it is
while (rset.next())
{
// do your processing
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Searching a record in resultset
 
Similar Threads
adding spacing between two divs inside a parent div
Understanding the behaviour of static initialization blocks
Drivers?
Tree expands to left
When will be a static block executed.