• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help Urgent

 
Hrithik Roshan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
//:~
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!