|  |  | 
|  |  | Archives of the TeradataForumMessage Posted: Fri, 08 Jun 2007 @ 11:15:12 GMT
 
 Unfortunately, the method that executes a query in JDBC doesn't return the number of rows, it returns a ResultSet. Further, the ResultSet doesn't have a concept of the total number of rows, nor does the ResultSetMetaData. The resultSet does however have a concept of the current, first and last row. You could try this (I haven't so let us know if it works for you): 
     resultSet.last ();
     resultSet.previous ();            // This might be required
                             to get to a valid row, experiment and
                             refer to the Javadocs.
     int numRows = resultSet.getRow ();
However, it is possible that the "last" method will retrieve the entire resultSet (i.e. take a long time). You might also want to try using a Scrollable resultset. For example: 
     Statement s = conn.createStatement
(         ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
Hope this helps Glenn Mc 
 | ||||||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||