The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000


where you can ask and answer Java programming questions."> - a resource for Java and Jini developers
Artima | Search | Java | Design | JVM | Jini | Books | Seminars | Subscribe 

Java Answers Forum
November 2000

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


JDBC Get the number of cols in a table

Posted by Rajeev Mutalik on April 11, 2001 at 7:30 AM

Following two lines in JDBC will get u the number of columns in the table.
ResultSetMetaData meta=rs.getMetaData();/*rs is an object of resultset*/
int col=meta.getColumnCount();
> I hav a resultset from JDBC. To get the number of records in the resultset (in turn find the number of records in underlying table, I use
> resultset.last();
> int rec = resultset.getRow();

> Isn't there a simple method?


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us