permaculture playing cards*
The moose likes JDBC and the fly likes ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet" Watch "ResultSet" New topic
Author

ResultSet

lape show
Greenhorn

Joined: Feb 07, 2010
Posts: 6
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.


lape
Brian Enochson
Greenhorn

Joined: Apr 12, 2011
Posts: 14

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

Joined: Oct 13, 2005
Posts: 38100
    
  22
. . . and welcome to the Ranch, both of you
lape show
Greenhorn

Joined: Feb 07, 2010
Posts: 6
Thanks a bunch!!!
Brian Enochson
Greenhorn

Joined: Apr 12, 2011
Posts: 14

Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet
 
Similar Threads
Display Data Records in Table
SQL Array Question
returning a ResultSet?
Passing VARRAYS to Java
Resultsets survives failure