File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Searching a ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Searching a ResultSet" Watch "Searching a ResultSet" New topic
Author

Searching a ResultSet

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1391
I am using java sql to get remote record data. After I get the ResultSet is there a faster way to searh for the existance of a string within the ResultSet other than iterating through the records with while loop?
Istvan Kovacs
Ranch Hand

Joined: May 06, 2010
Posts: 100
Steve Dyke wrote:I am using java sql to get remote record data. After I get the ResultSet is there a faster way to searh for the existance of a string within the ResultSet other than iterating through the records with while loop?


I don't know of any. Maybe you should change your SQL query to make the information you need more readily available?
Nevin kumar
Ranch Hand

Joined: Mar 15, 2008
Posts: 93
You can try Google's java collections,lambdaj features. you can apply filtering on all sort of collections.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Nevin: won't be any faster, though, just cleaner.

@Steve: no. As Istvan said, maybe querying better would be a cleaner solution.
Manish Singh
Ranch Hand

Joined: Jan 26, 2007
Posts: 160
Fastest possible way would be an exact query to be sent to the DB. as the DB might make use of proper indexing and the unnecessary data wont travel from DB to the java machine.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

I agree with Istvan and Manish. Let the database server do the hard work, and as a bonus get less results so less network traffic.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Searching a ResultSet
 
Similar Threads
how can I get Record Count from ResultSet?
Exhausted Resultset exception when result count is huge.
jsp resultset
resultset data stored in database or java
Clarrifications about ResultSet object?