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.
Message:
JDBC Get the number of cols in a table
Posted by Rajeev Mutalik on April 11, 2001 at 7:30 AM
Hello, 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?
Replies:
|