jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes Help Urgent 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 "Help Urgent" Watch "Help Urgent" New topic
Author

Help Urgent

Hrithik Roshan
Greenhorn

Joined: Dec 12, 2001
Posts: 23
hi, java Ranchers
i want to get the count of the rows in the resultSet without
iterating through the resultset.next()
any suggestion is welcome!
thanx!!
------------------
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Two suggestions:
Either perform the query as a count(*) first to get the number returned then perform the real query (ie make two queries, less efficient but not too bad if you do it efficiently)
Or, if you have a driver that supprts JDBC2.0 or later, you can jump to the end of the ResultSet and find out what row number that is.
Dave.
Hrithik Roshan
Greenhorn

Joined: Dec 12, 2001
Posts: 23
Originally posted by David O'Meara:
Two suggestions:
Either perform the query as a [b]count(*)
first to get the number returned then perform the real query (ie make two queries, less efficient but not too bad if you do it efficiently)
Or, if you have a driver that supprts JDBC2.0 or later, you can jump to the end of the ResultSet and find out what row number that is.
Dave.[/B]

thanx Dave!!
//:~
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help Urgent