• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet

 
lape show
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please how can i get the number of rows returned by a resultset. i need to pass data retrieved from SQL into an array then to the table model and finally to the jtable, but i need to know the size of the array.
 
Brian Enochson
Greenhorn
Posts: 14
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been covered. http://www.coderanch.com/t/303346/JDBC/java/find-number-rows-resultset.

What you can also do is a select count with an identical where clause to your where used for the actual select?

Lastly, instead of using an array where you need to allocate it, add your results from your result set to an ArrayList as it will grow dynamically.

Brian

 
Campbell Ritchie
Sheriff
Posts: 51349
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch, both of you
 
lape show
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a bunch!!!
 
Brian Enochson
Greenhorn
Posts: 14
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic